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),

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.