Jump to content

creating table from array of strings


peuge

Recommended Posts

I have called in an array of names entered in from a field in the previous php page. with these names I want to create a table 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['fname'];

$tname = $_POST['tname'];

 

 

mysql_query("CREATE TABLE $tname(

id INT NOT NULL AUTO_INCREMENT,

PRIMARY KEY(id),

username VARCHAR(30),

password VARCHAR(32))")

or die(mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/98036-creating-table-from-array-of-strings/
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.