I'm attempting to create a mysql table based on a variable from php but it fails without any explanation.
$name = mysql_real_escape_string($_POST['name']);
mysql_query("CREATE TABLE `".$name."` ( name VARCHAR(30), type VARCHAR(30), style VARCHAR(30))");
When I set $name = test; it then works but not with the variable fetching attached to it.
I've looked at this link among others and they all say it should work but from what I'm seeing it doesn't.
Update:
I've also tried the code below but that takes the page offline.
$variable=$_POST['name'];
mysqli_connect("localhost", "devices", "a") or die(mysql_error());
mysqli_select_db("devices") or die(mysqli_connect_error());
mysqli_query("CREATE TABLE $variable ( computer text, mac text, windows text)");
I'm running PHP version 5.5.36