Quote:
Originally Posted by inaz4sun
I have a query that looks like this:
mysql_query("UPDATE layer1108 SET `set` = '$set', `order` = '$i' WHERE `item` = '$item' $col_check");
And it works the way I want, but I want the layer1108 to be dynamic. I have tried declaring this ahead of time and then putting that variable in. This doesn't work:
mysql_query("UPDATE $layerID SET `set` = '$set', `order` = '$i' WHERE `item` = '$item' $col_check");
But when I do this it works:
$dynamic_table_name = "layout1108";
mysql_query("UPDATE $dynamic_table_name SET `set` = '$set', `order` = '$i' WHERE `item` = '$item' $col_check");
But it doesn't work when I again make the "layout1108" a $layoutID variable.
Any thoughts on how to get this to work?
This looks like a problem in your PHP code. The only difference between when you use $dynamic_table_name and when you use $layerID is the variable name, now since both are valid PHP identifiers, the problem must be with the value that you are setting when you use $layerID. How are you assigning values to it and what is the error that you're getting when you run it?