Jump to content

table creation loop problem


m3atwad

Recommended Posts

I am trying to create a bunch of tables (50) and i am using a loop to do so.  The problem is they all have diff. names so i got to use a variable as the name so i can keep changing the variable every time the loop executes.

$query = 'CREATE TABLE $state(
id INT AUTO_INCREMENT,
profile_name VARCHAR(50),
real_name VARCHAR(40),
personal_description TEXT,
email VARCHAR(40),
state VARCHAR(25),
personal_website VARCHAR(50),
type_of_work VARCHAR(30),
sex VARCHAR(10),
age INT,
experience VARCHAR(40)
pic_availability VARCHAR(10),
height_feet INT,
height_inches INT,
weight INT,
hair_color VARCHAR(30),
bust_inches INT,
bust_cup VARCHAR(10),
ethnicity VARCHAR(20),
eye_color VARCHAR(10),
pic1 VARCHAR(40),
pic2 VARCHAR(40),
pic3 VARCHAR(40),
pic4 VARCHAR(40),
pic5 VARCHAR(40),
pic6 VARCHAR(40),
pic7 VARCHAR(40),
pic8 VARCHAR(40),
pic9 VARCHAR(40),
pic10 VARCHAR(40),
key VARCHAR(40),)';

the query looks like that where $state is the name of the table (50 states) and every iteration it changes.  Can this be done this way?
Link to comment
https://forums.phpfreaks.com/topic/33359-table-creation-loop-problem/
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.