Posted by Gordon Burditt on 07/21/05 00:06
>Is it possible to set a variable from a query that will return one
>row ie..
>
>$control = mysql_query("SELECT control FROM table WHERE id = '1'");
Yes, but $control is a MySQL result handle, not the value.
To get the value (and there are a number of different ways to do this,
and you really need to do some error checking in case there was no
row with id = 1):
$r = mysql_fetch_result($control);
$value = $r[0];
/* we now have the value you wanted in $value */
echo "$value";
mysql_free_result($control);
Gordon L. Burditt
Navigation:
[Reply to this message]
|