Jump to content

need simple syntax for creating table AND populating fields with data


simcoweb

Recommended Posts

I'm writing a query to create a table but want to also provide entries into those fields as values at the same time. I know the syntax for the table creation but can't find a reference anywhere (include mysql site and cheat sheets, etc.). Here's a sample of what I have. Just looking for the right syntax to insert the values at the same time of creation.

 

mysql_query("CREATE TABLE property_types(

id INT NOT NULL AUTO_INCREMENT,

PRIMARY KEY(id),

propertytypes VARCHAR(100),

property_type2 VARCHAR(100),

property_type3 VARCHAR(100),

property_type4 VARCHAR(100),

property_type5 VARCHAR(100),

property_type6 VARCHAR(100),

property_type7 VARCHAR(100),

property_type8 VARCHAR(100),

property_type9 VARCHAR(100),

property_type10 VARCHAR(100),

property_type11 VARCHAR(100),

property_type12 VARCHAR(100),

property_type13 VARCHAR(100),

property_type14 VARCHAR(100),

property_type15 VARCHAR(100),

property_type16 VARCHAR(100),

property_type17 VARCHAR(100),

property_type18 VARCHAR(100),

property_type19 VARCHAR(100),

property_type20 VARCHAR(100),

property_type21 VARCHAR(100),

property_type22 VARCHAR(100),

property_type23 VARCHAR(100),

property_type24 VARCHAR(100),

property_type25 VARCHAR(100),

property_type26 VARCHAR(100),

property_type27 VARCHAR(100),

property_type28 VARCHAR(100)")

or die(mysql_error());

 

echo "Table successfully created!";(100),

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.