I'm trying to create a table whose name is the value of what is stored inside the variable $name
. I have tried numerous different methods but none seem to work for me. Here is the code I am using currently:
mysql_connect("localhost", "peltdyou_admin", "123456") or die(mysql_error());
mysql_select_db("peltdyou_orders") or die(mysql_error());
mysql_query("CREATE TABLE '" .$_POST['name']. "' ( name VARCHAR(30), age INT, car VARCHAR(30))");
I know it is something to do with '" .$_POST['name']. "'
but I can't work out what.
I have tried '$name'
in its place which gets it's value from further up in the code.
Any help would be great!