Jump to content

Creating table fields from an array


peuge

Recommended Posts

I have called in an array of field names entered in a from from a form in the previous php page. with these names I want to create with these field names in the database which has already been selected. The thing is these names could be different for each time I create a new table so I need to use these names from the array. Can I do this in the CREATE TABLE?

 

$name_array = $_POST['fieldname'];

$tname = $_POST['tname'];

 

 

mysql_query("CREATE TABLE $tname(

id INT NOT NULL AUTO_INCREMENT,

PRIMARY KEY(id),

//WHAT DO I PUT HERE?

Link to comment
https://forums.phpfreaks.com/topic/98075-creating-table-fields-from-an-array/
Share on other sites

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.