user5422072
user5422072

Reputation:

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);

Upvotes: 0

Views: 40

Answers (1)

Gavindra Kalikapersaud
Gavindra Kalikapersaud

Reputation: 547

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

Upvotes: 2

Related Questions