PDA

View Full Version : Creating a new SQL table


MPCODER
04-08-2004, 05:09 PM
Hi,
I've been having problems with creating a new table using a php page,
this is the code i use:
$query = "CREATE TABLE `pictures` (
`id` int( 11 ) NOT NULL ,
`gebruiker` VARCHAR( 255 ) NOT NULL ,
`foto` VARCHAR( 255 ) NOT NULL ,
`description` VARCHAR( 255 ) NOT NULL
);";
$result = mysql_query($query);



echo "Table <b>Pictures</b> Created";
But this doesn't seem to work. Because it isn't doing something, not executing the query, how can i let it execute it?
Please help me
Cheers MPCODER

Nightfire
04-08-2004, 06:15 PM
Try this

$query = "CREATE TABLE `pictures` (
`id` int( 11 ) NOT NULL ,
`gebruiker` VARCHAR( 255 ) NOT NULL ,
`foto` VARCHAR( 255 ) NOT NULL ,
`description` VARCHAR( 255 ) NOT NULL
)";
mysql_query($query) or die(mysql_error());


echo "Table <b>Pictures</b> Created";

It'll tell you the error then, and I'm sure it was the ; in the query. It often throws an error