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 Quote Link to comment 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\'\"; Quote Link to comment 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 = Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.