php/mysql
| From: | Ramiro Radjiman | Date: | Wed, 21 Feb 2001 21:58:27 +0000 |
| Subject: | php/mysql | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6845@lists.php.net to get a copy of this message | ||
i have this code.
function create_mysqltable($db_name,$table_name){
mysql_select_db($db_name);
$sql_query = "CREATE TABLE IF NOT EXISTS $table_name "
. "( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, "
. " soort char(20), "
. " aantal varchar(20) DEFAULT '0', "
. " str_men varchar(20) DEFAULT '0', "
. " recht varchar(20) DEFAULT '0', "
. " rechtverstek varchar(20) DEFAULT '0', "
. " verstekgelijk varchar(20) DEFAULT '0', "
. " verstekongelijk varchar(20) DEFAULT '0', "
. " PRIMARY KEY (id), "
. " UNIQUE id (id))";
mysql_query($sql_query)
or die (" cannot execute create query");
}
the following code repeats saying ERORR : cannot execute query.
if i delete the text IF NOT EXISTS al goes good.
I don't understand why.
Please help.