question about passing field name in sql statement as variable.



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.

.