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. - <?php
-
-
error_reporting(E_ALL);
-
ini_set('display_errors', '1');
-
-
$hostname = "localhost";
-
$username = "1104107";
-
$password = "r940c1";
-
$database = "db1104107";
-
//echo '24';
-
-
//connection to the database
-
$dbhandle = mysql_connect($hostname, $username, $password);
-
$db = mysql_select_db($database, $dbhandle)
-
or die("Unable to connect to MySQL");
-
echo "Connected to MySQL<br>";
-
echo '4';
-
$query_createTemporaryTable = "CREATE TEMPORARY TABLE `Basket`(
-
temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-
ArtistName VARCHAR( 20 ) ,
-
NAMEOfTheDVD VARCHAR( 30 )
-
)Engine = MyISAM";
-
-
$result_createtemptable = mysql_query($query_createTemporaryTable);
-
echo $result_createtemptable;
-
$query_insertintotable = "INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK')";
-
-
$result_insertintotable = mysql_query($query_insertintotable ) or die(mysql_error());
-
-
$query_selecttemptable = "SELECT ArtistName,NAMEOfTheDVD FROM Basket`";
-
-
$result_selecttemptable = mysql_query( $query_selecttemptable) or die(mysql_error());
-
-
while($row_selecttemptable = mysql_fetch_array($result_selecttemptable))
-
echo $row_selecttemptable['ArtistName'] . ' ,' . $row_selecttemptable['NAMEOfTheDVD'];
-
-
-
-
-
?>
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
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: - 140105 19:04:52 3506 Connect test@localhost as anonymous on
-
3506 Init DB test
-
3506 Query CREATE TEMPORARY TABLE `Basket`(
-
temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-
ArtistName VARCHAR( 20 ) ,
-
NAMEOfTheDVD VARCHAR( 30 )
-
)Engine = MyISAM
-
3506 Query INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK')
-
3506 Query SELECT ArtistName,NAMEOfTheDVD FROM Basket`
-
3506 Quit
-
so, YES, it looks like its working!
Congratulations!
4 4816
Whats RTFM? So, basically what I am doing is right then?
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: - 140105 19:04:52 3506 Connect test@localhost as anonymous on
-
3506 Init DB test
-
3506 Query CREATE TEMPORARY TABLE `Basket`(
-
temporary_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
-
ArtistName VARCHAR( 20 ) ,
-
NAMEOfTheDVD VARCHAR( 30 )
-
)Engine = MyISAM
-
3506 Query INSERT INTO Basket( ArtistName, NAMEOfTheDVD) VALUES ( 'R', 'SHAWooSHANK')
-
3506 Query SELECT ArtistName,NAMEOfTheDVD FROM Basket`
-
3506 Quit
-
so, YES, it looks like its working!
Congratulations!
woohoooo i thank you soo much/. I have been working tirelessly on this.. Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu. Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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.
...
|
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:...
|
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...
|
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...
|
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:...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |