WesleyA Posted May 29, 2015 Share Posted May 29, 2015 I have a script and a MYSQL query its supossed to create a new table $variable now I have $sql = "CREATE TABLE '$variabele' "; But it doesnt work. I think CREATE TABLE works for constants not for variables. Which query should I use? Link to comment Share on other sites More sharing options...
Ingolme Posted May 29, 2015 Share Posted May 29, 2015 It needs to be wrapped in backticks, not quotation marks. CREATE TABLE `$table_name` Make sure that $table_name is properly escaped before putting it into the query. MySQL doesn't see a variable there, it sees the value that was contained in the variable, the variable is a PHP thing. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now