[thelist] php+mySQL

Jay Blanchard jay.blanchard at niicommunications.com
Thu May 23 13:01:13 CDT 2002


[snip]
$db_connect = mysql_select_db("$db_name", $link) or die ("Could not find the
database.");
mysql("CREATE TABLE $db_tablename ($name char(20) NOT NULL,$description
char(50) NOT NULL,$version char(20) NOT NULL)");
[/snip]

You need to treat the query for table creation the same as any other query.

$createsql = "CREATE TABLE $db_tablename ($name char(20) NOT NULL ";
$createsql .= "$description char(50) NOT NULL ";
$createsql .= "$version char(20) NOT NULL) ";

Don't forget to concat variables in these statements, and make sure the user
has grants to create, and make sure to flush!

HTH!

Jay





More information about the thelist mailing list