Hi,
I have a script that I need to use a variable to select the database table that I want to update or to get the results from. But for some reason when I use the variable I get error. If I replace the variable with the table name, it works fine.
Here is the part of the code related to this issue:
[CODE=php]<?php
$memberID = $_GET['cm'];
if ($memberID < 50001)
$data_table = 'new_members' &&
$auth_token = "first_toke n";
else
$data_table = 'old_members' &&
$auth_token = "second_tok en";
$find_customer = mysql_query("SE LECT * FROM '$data_table' WHERE id = $memberID");
while($customer _info = mysql_fetch_arr ay($find_custom er))
{
$customer_full_ name = $customer_info['first_name'] . " " . $customer_info['last_name'];
$customer_email _address = $customer_info['email'];
}
?>
[/CODE]
I have a script that I need to use a variable to select the database table that I want to update or to get the results from. But for some reason when I use the variable I get error. If I replace the variable with the table name, it works fine.
Here is the part of the code related to this issue:
[CODE=php]<?php
$memberID = $_GET['cm'];
if ($memberID < 50001)
$data_table = 'new_members' &&
$auth_token = "first_toke n";
else
$data_table = 'old_members' &&
$auth_token = "second_tok en";
$find_customer = mysql_query("SE LECT * FROM '$data_table' WHERE id = $memberID");
while($customer _info = mysql_fetch_arr ay($find_custom er))
{
$customer_full_ name = $customer_info['first_name'] . " " . $customer_info['last_name'];
$customer_email _address = $customer_info['email'];
}
?>
[/CODE]
Comment