Variables as table name?
Posted: Fri Jul 02, 2004 9:11 pm
I want to be able to define a table name prefix so that it's easy to change in the php script. The table name "suffix" / main name should stay the same.
But what is the correct format in the MySQL select?
Let's say that the table name is "pre_tblname". I define $tb_prefix such as:
$tb_prefix = "pre";
Now the SELECT part of the MySQL query should look something like:
But I know this is not the right format. So how can this be done?
Thanks!
Tomas
But what is the correct format in the MySQL select?
Let's say that the table name is "pre_tblname". I define $tb_prefix such as:
$tb_prefix = "pre";
Now the SELECT part of the MySQL query should look something like:
Code: Select all
$query = "SELECT * FROM `$tb_prefix_tblname`";Thanks!
Tomas