Jump to content

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

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.