Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query logic/ error?

Status
Not open for further replies.

wudz

Programmer
Mar 28, 2001
135
0
0
GB
Hi,
I wish to extract a user id (req_user)who has made the last post on the viewed auction ($auction_id) from a table containing many different auction_id's and which also contains many of the required auction_ids.

I require the last posted record associated with the auction being viewed ($auction_id), but ignore the seller's previous post, if his was the last posted.


//----Get previous questioniare users ID
$query = "select req_user from AUCTION_request WHERE req_auction=$auction_id AND req_user<>$seller_id ORDER BY id DESC, limit 1";
$result = mysql_query($query);
if(!$result) {
MySQLError($query);
exit;
}
With the above script I get an error "check your syntax around limit 1"..

1> Is the query correct in logic..
2> Not sure how to cure the error as I only require 1 record.

many thanks in anticipation

John

Flash
 
Thanks ArkM,

did the trick, getting to grips with PHP, but still making silly errors...hopefully learn by my mistakes..

Cheers

john

Flash
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top