Page 1 of 1

keep max value in a variable

Posted: Thu Dec 14, 2006 9:41 am
by sarris
hi there...i want to keep the max value of a table (lets say for price column) on a variable on php, in order to call [s]smth[/s]something like this
mysql_querry (select * from '$table' where price between $pricemin and $pricemax); (pricemin is not the min of the table,its defined in other way)

How can i have on $pricemax the max value of a certain field of a certain table..
I know how to get it using
SELECT max( price ) FROM `table` but i dont know how to get that on a variable.

Thanks for any help

Posted: Thu Dec 14, 2006 9:50 am
by feyd
You get it just like you get any other data from a MySQL SELECT query: mysql_fetch_row(), mysql_fetch_array(), mysql_fetch_assoc() or mysql_result().

Posted: Thu Dec 14, 2006 9:52 am
by sarris
ok...thought there would be a simpler way.
thanks