Dawie Posted November 2, 2003 Share Posted November 2, 2003 Hi I\'m storing a MySql table name in a PHP variable e.g. $tbl = \"example\".$coy; Why does: $sql_command = (\"SELECT * FROM \'<?php echo $tbl; ?>\' WHERE id = \'$id\'\"); not work? Is there a way to do it? I unfortunately HAVE to store the table name in a variable cuz it is different for different companies. Thanks Link to comment https://forums.phpfreaks.com/topic/1269-mysql-table-name-stored-in-php/ Share on other sites More sharing options...
Alien Posted November 3, 2003 Share Posted November 3, 2003 I am not sure why you have parentheses. try this $sql_command = \"SELECT * FROM \" . $tbl . \" WHERE id = \'$id\'\"; Link to comment https://forums.phpfreaks.com/topic/1269-mysql-table-name-stored-in-php/#findComment-4255 Share on other sites More sharing options...
Dawie Posted November 3, 2003 Author Share Posted November 3, 2003 Thanks, I was a bit confused with the syntax.. but then, I\'m also a newbie = Link to comment https://forums.phpfreaks.com/topic/1269-mysql-table-name-stored-in-php/#findComment-4258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.