| 
 Posted by nephish on 08/30/06 21:14 
hey there, 
can anyone tell me if this is legal php/mysql ? 
i am trying to write a simple function to get a single stat from a 
single table. 
 
eg.. 
 
$field = 'phone_number'; 
$customer = 'fred'; 
 
$query = mysql_query("SELECT `'{$field}'` FROM `customers` WHERE `name` 
= '{$fred}' "); 
// note the back quotes around $field 
 
or is this an accident waiting to happen ? 
 
thanks.
 
  
Navigation:
[Reply to this message] 
 |