Forum Moderators: open

Message Too Old, No Replies

creating temp tables

I need to create a temporary table

         

rogerg1967

9:00 am on Apr 30, 2007 (gmt 0)

10+ Year Member



I am sure this is very easy but i keep getting erors when i try to do this. I am using dreamweaver, and I want to create a temporary table to store data that will be printed later. I have used what i think is the right code but i keep getting the same error messages

Parse error: syntax error, unexpected T_VARIABLE, expecting T_CONSTANT_ENCAPSED_STRING in....

Can anyone help me with this please.

Regards

Roger

eelixduppy

10:53 am on Apr 30, 2007 (gmt 0)



Looks like a PHP error. What's the line that is causing the error? Give one or two lines before that, too.

rogerg1967

4:51 pm on Apr 30, 2007 (gmt 0)

10+ Year Member



The code I am using is this:

CREATE TABLE addresses (
ID SMALLINT NOT NULL AUTO_INCREMENT,
Name VARCHAR(60) NOT NULL,
DOB DATE NOT NULL,
HouseNumber VARCHAR(5) NOT NULL,
Street VARCHAR(30) NOT NULL,
City VARCHAR(15) NOT NULL,
Country VARCHAR(30) NOT NULL,
Telephone VARCHAR(15) NOT NULL,
Fax VARCHAR(15) NOT NULL,
Email VARCHAR(30) NOT NULL,
Remarks TEXT,
PRIMARY KEY(ID)
);

the error is in the 1st line of this code.

Regards and thanks

Roger

eelixduppy

7:11 pm on Apr 30, 2007 (gmt 0)



Roger, the syntax for your MySQL looks fine. The error that you are getting is PHP related, not MySQL. Most likely a misplacement of a quote or semicolon--something along those lines. If you'd like, post the PHP code where you have your query, and we can work from there.

rogerg1967

6:22 pm on May 2, 2007 (gmt 0)

10+ Year Member



This is the code now. It works fine except for the drop table code. I need to drop it to ensure that on ly new data gets sent to the table.

mysql_select_db($database_abruzzo, $abruzzo);
$query_temptable = "DROP TEMPORARY TABLE IF EXISTS print_list";
mysql_select_db($database_abruzzo, $abruzzo);
$query_temptable = "create temporary table print_list(
id int not null,
address_1 char(30) not null,
district char(20) not null,
price char(20) not null,
image1 char(20) not null,
short_desc char(20) not null,
)";
$temptable = mysql_query($query_temptable, $abruzzo) or die(mysql_error());

I am not sure why but it keeps telling me that the table exists if i refresh the page!

Also i am having problems sending data to the table. I am using the following php code to send a value.

<?php $query = "insert into print_list" "".$row_main_search['short_desc']."<br>";?>

I hope someone can help with this.

Thanks in advance

Roger