Clifton Miranda Clifton Miranda - 1 month ago 6
MySQL Question

I want the last value from a sql column with where condition

I want the last value from my query .
i tried end();
did not work..

$last_ad_idx=mysql_query("SELECT ads_id FROM ads WHERE id='$id'");
$target_ad_id = mysql_fetch_array($last_ad_idx);

Answer
 SELECT ads_id FROM ads WHERE id='$id' order by ads_id desc limit 1
Comments