php - MySQL Table Creation Query Not Working -
i working on installation script creates tables inside database, in script have written detects if table created, exists , can't create table @ all. reason can't seem work, me?
/* database queries */ $dbusers = mysqli_query($con, 'create table users (id int(9) not null auto_increment primary key, username varchar(40) not null, password varchar(40) not null'); /* check if users table created */ if ($dbusers) { ?> <p>table "users" created.</p> <?php } elseif (mysqli_query($con, "select * users")) { ?> <p>table "users" exists."</p> <?php } else { ?> <p>unable create "users" table.</p> <?php }
so have ideas on how improve or fix code?
you missed closing ) @ end of create
statement:
create table users (id int(9) not null auto_increment primary key, username varchar(40) not null, password varchar(40) not null)
Comments
Post a Comment