mysql - Select query with MAX(ad_number) issue -
$r = ca_mysql_query("select max(ad_number) `mytable` `user` = {$user_id} "); $max = $r[0]['ad_number']; echo $max;
it should print max ad_number not returning value
wheares, if try query removing max(ad_number) returnig field data array.
$r = ca_mysql_query("select * `mytable` `user` = {$user_id} "); $max = $r[0]['ad_number'];
is returning value given records
whats wrong ?
use alias column:
select max(ad_number) max_ad_number mytable user = {$user_id}
then this:
$max = $r[0]['max_ad_number']; echo $max;
see documentation w3schools here
Comments
Post a Comment