Hey!
Firstly, you're gonna have trouble with:
You wanna use double quotes here. If you use single quotes, your $table variable will actually remain literally as '$table' and not get replaced with the value inside that variable.
I don't see any syntax errors here - I ran this code and it had no syntax errors.
I can see how you would get a runtime error however for your sql. You're gonna have a dangling comma at the end. You're gonna get something like:
Code: Select all
"Create table $table (name1 VARCHAR(50), name2 VARCHAR(50), "
So what you want to do is:
Code: Select all
$sql = substr($sql, 0, strlen($sql)) . ")";
Hope that helps!
Georges,
http://www.websites.ca