473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Temporary Table PhpMyAdmin

Hello Everyone,

I have written code to create Temporary Table using PHP script. Now, when I run the script, it seems to have created the temporary table. Now, my problem is when I try to do INSERT statement in PhpMyAdmin into the temporary table I create, I am getting an error message in phpMyAdmin which says table not found. The thing is I do not know if I am creating the temp tables correctly or If I am not writing the code properly. Any help would be appreciated.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. error_reporting(E_ALL);
  4. ini_set('display_errors', '1');
  5.  
  6. $hostname = "localhost"; 
  7. $username = "1104107";
  8. $password = "r940c1";
  9. $database = "db1104107";
  10. //echo '24';
  11.  
  12. //connection to the database
  13. $dbhandle = mysql_connect($hostname, $username, $password);
  14. $db = mysql_select_db($database, $dbhandle)
  15.   or die("Unable to connect to MySQL");
  16. echo "Connected to MySQL<br>";
  17. echo '4';
  18. $query_createTemporaryTable = "CREATE TEMPORARY TABLE `Basket`(
  19. temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  20. ArtistName VARCHAR( 20 ) ,
  21. NAMEOfTheDVD VARCHAR( 30 )
  22. )Engine = MyISAM"; 
  23.  
  24. $result_createtemptable = mysql_query($query_createTemporaryTable); 
  25. echo $result_createtemptable;
  26. $query_insertintotable = "INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK')"; 
  27.  
  28. $result_insertintotable = mysql_query($query_insertintotable ) or die(mysql_error()); 
  29.  
  30. $query_selecttemptable = "SELECT ArtistName,NAMEOfTheDVD FROM Basket`"; 
  31.  
  32. $result_selecttemptable = mysql_query( $query_selecttemptable) or die(mysql_error()); 
  33.  
  34.  while($row_selecttemptable = mysql_fetch_array($result_selecttemptable)) 
  35.       echo $row_selecttemptable['ArtistName'] . ' ,' . $row_selecttemptable['NAMEOfTheDVD'];
  36.  
  37.  
  38.  
  39.  
  40. ?>
Please note I have tried a couple of forums and I have not been able to resolve this issue. I thank you in advance for helping me. Looking forward for replies
Jan 5 '14 #1

✓ answered by Luuk

RTFM is an acronym...
see: http://www.urbandictionary.com/define.php?term=RTFM

For your script, i copied it, and tested it here.
I have query-log enabled on my MySQL server, and it shows:
Expand|Select|Wrap|Line Numbers
  1. 140105 19:04:52  3506 Connect   test@localhost as anonymous on
  2.                  3506 Init DB   test
  3.                  3506 Query     CREATE TEMPORARY TABLE `Basket`(
  4.     temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  5.     ArtistName VARCHAR( 20 ) ,
  6.     NAMEOfTheDVD VARCHAR( 30 )
  7.     )Engine = MyISAM
  8.                  3506 Query     INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK')
  9.                  3506 Query     SELECT ArtistName,NAMEOfTheDVD FROM Basket`
  10.                  3506 Quit
  11.  
so, YES, it looks like its working!
Congratulations!

4 4816
Luuk
1,047 Expert 1GB
RTFM ;-)
"Temporary Tables

.... A TEMPORARY table is visible only to the current connection, ...."
( http://dev.mysql.com/doc/refman/5.5/...ate-table.html )
Jan 5 '14 #2
Whats RTFM? So, basically what I am doing is right then?
Jan 5 '14 #3
Luuk
1,047 Expert 1GB
RTFM is an acronym...
see: http://www.urbandictionary.com/define.php?term=RTFM

For your script, i copied it, and tested it here.
I have query-log enabled on my MySQL server, and it shows:
Expand|Select|Wrap|Line Numbers
  1. 140105 19:04:52  3506 Connect   test@localhost as anonymous on
  2.                  3506 Init DB   test
  3.                  3506 Query     CREATE TEMPORARY TABLE `Basket`(
  4.     temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
  5.     ArtistName VARCHAR( 20 ) ,
  6.     NAMEOfTheDVD VARCHAR( 30 )
  7.     )Engine = MyISAM
  8.                  3506 Query     INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK')
  9.                  3506 Query     SELECT ArtistName,NAMEOfTheDVD FROM Basket`
  10.                  3506 Quit
  11.  
so, YES, it looks like its working!
Congratulations!
Jan 5 '14 #4
woohoooo i thank you soo much/. I have been working tirelessly on this.. Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu.
Jan 5 '14 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Corrine | last post by:
Hi, I am creating a global temporary table that is session-specific. I insert a BLOB into this table, and then select the BLOB from this table into a ResultSet. The ResultSet sees this BLOB...
5
by: Jim Garrison | last post by:
Scenario: 1) Create a GLOBAL TEMPORARY table and populate it with one (1) row. 2) Join that table to another with about 1 million rows. The join condition selects a few hundred rows. ...
0
by: Didier ROS | last post by:
Hi, I am a newbie I want to create a temporary table and I get the following error message : mysql> CREATE TEMPORARY TABLE tempemp AS SELECT * FROM emp; ERROR 1044: Access denied for user:...
4
by: gonzal | last post by:
Hi Dose any body know why a temporary table gets deleted after querying it the first time (using SELECT INTO)? When I run the code bellow I'm getting an error message when open the temp table...
11
by: randi_clausen | last post by:
Using SQL against a DB2 table the 'with' key word is used to dynamically create a temporary table with an SQL statement that is retained for the duration of that SQL statement. What is the...
0
by: nedbollard | last post by:
Hi, Having checked out a declared (rather than created) temporary table successfully in SPUFI, I have hit a problem in running the same SQL in the cobol prog I am ameding to use it. I have:...
4
by: prasad | last post by:
I am getting sql error during binding a program which access a temporary table. The temporary table declaration and access methods are given below. EXEC SQL DECLARE GLOBAL TEMPORARY TABLE TEM88...
7
by: Larry | last post by:
Hi, I have unbelievable problems just to save a record! I make an input to a record in a subform, which has a temporary table as its recordsource. When I am done, and want to save the...
5
by: Adam W. Saxton | last post by:
We have a few existing stored procedures which create a Global Temporary Table (##), do some work on the table and then delete the table. The issue we have is that if our Server application is...
5
by: Rahul B | last post by:
Hi, I have very little knowledge about creating Procedures/functions in DB2. When i tried to create the test function like CREATE FUNCTION GET_TEST (P_TEST_ID INTEGER, P_SEL_OR_SORT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.