php - Can't create my table -


i tried with/without quotes, with/without or exit(), tripple checked connected db correctly.

edit: getting own custom error:

$username="user"; $password="*****"; $hostname="localhost";  mysql_connect($hostname,$username,$password) or exit("error: @mysql_connect."); mysql_select_db("test") or exit("error: @mysql_select_db.");  mysql_query("create table propiedades( 'id' smallint not null auto_increment, 'colonia' varchar(35), 'zona' varchar(35), 'precio' decimal(9,2), 'usd' boolean, 'tipo' tinyint, 'venta' boolean, 'recamaras' tinyint, 'banos' tinyint, 'mbanos' tinyint, 'plantas' tinyint, 'construccion' smallint, 'terreno' smallint, 'edad' tinyint, 'uploaded' timestamp default current_timestamp, 'updated' timestamp default current_timestamp, 'ocultar' boolean not null default 0, primary key (id))") or exit("error: @mysql_query create table."); 

my code throwing "error: @mysql_query create table."

i didn't check query's syntax, i'm demonstrating how should done. mario in comment above said, can't feed pure mysql code php , expect work... need use mysql api or pdo.

$sql = '     create table propiedades(     `id` smallint not null auto_increment,     `colonia` varchar(35),     `zona` varchar(35),     `precio` decimal(9,2),     `usd` boolean,     `tipo` tinyint,     `venta` boolean,     `recamaras` tinyint,     `banos` tinyint,     `mbanos` tinyint,     `plantas` tinyint,     `construccion` smallint,     `terreno` smallint,     `edad` tinyint,     `uploaded` timestamp default current_timestamp,     `updated` timestamp default current_timestamp,     `ocultar` boolean not null default 0,     primary key (id))';  $result = mysql_query($sql);  if (!$result)     exit("error: @create table."); 

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -