[thelist] creating a mySQL table dynamically in php

Tom Dell'Aringa pixelmech at yahoo.com
Mon Jan 6 15:03:01 CST 2003


I'm trying to create a table in my DB with a script. Here is the
code:
-----------------
// connection stuff

$sql  = " CREATE TABLE test  (";
$sql .= "   pid    VARCHAR(12), ";
$sql .= "   qty    VARCHAR(12), ";
$sql .= " );  ";

if(!@mysql_query($sql))
{
	print "Err" . mysql_error();
	exit();
}
-----------------

I don't get the table, I keep getting this type of error:

You have an error in your SQL syntax near '); ' at line 1

I tried putting it all together in one line with no success. I'm not
sure where the quotes go but I figure it is that kind of
error..anyone?

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list