php, mySQL - how to create a table?

Posted by user296516 on Stack Overflow See other posts from Stack Overflow or by user296516
Published on 2010-05-12T16:58:13Z Indexed on 2010/05/12 17:14 UTC
Read the original article Hit count: 322

Filed under:
|

Hi guys, I have written a code that should check weather there is a table called imei.$addimei and, if not, create it...

$userdatabase = mysqli_connect('localhost', 'root', 'marina', 'imei');
...
$result = mysqli_query($userdatabase, "SELECT * FROM imei".$addimei."" );
if ( !$result ) { echo('creating table...'); /// if no such table, make one!

mysql_query ( $userdatabase,
'CREATE TABLE imei'.$addimei.'(
ID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(ID),

EVENT varchar(15),
TIME varchar(25),
FLD1 varchar(35),
FLD2 varchar(35),
IP varchar(25),
)' );
}

Yet the CREATE TABLE somehow doesn't seem to work. Warning: mysql_query() expects parameter 1 to be string, object given in C:\xampp\xampp\htdocs\mobi\mainmenu.php on line 564

Any idea's what wrong? Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql