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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selective SELECT problem...

Status
Not open for further replies.

wudz

Programmer
Mar 28, 2001
135
GB
Hi,
just another spanner in the works...

This UPDATE works great....

//update purchased credit table

$query = "UPDATE AUCTION_purchcredit
SET ver_date = NOW(),
pp_verified = 'y'
WHERE user_id='".$_SESSION["AUCTION_LOGGED_IN"]."'
ORDER BY id DESC LIMIT 1";

How can I do a SELECT query on the table below with the simlar criteria as the UPDATE which works great..
i.e.
I wish to access a field using the user id of their last place in the table amongst other users.
Tried a cobble of your last code supplied on the forum which works great on the UPDATE, but get error check your version ofmysql for the correct syntax on the script below..is there a work round or have I got it wrong?.

//get amount of credit purchased

$query = "SELECT pur_credit AUCTION_purchcredit
WHERE user_id='$id'
ORDER BY id DESC LIMIT 1";

Cheers in anticipation

John
 
Here is a correct syntax to select some data from a table using the criteria you specified:
Code:
"SELECT fieldname FROM tablename WHERE user_id='$id' ORDER BY id DESC LIMIT 1"
This assumes you have a field called "id" in the table (so that the ORDER BY is able to work).

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Cheers Jeff,

That's twice I have made this mistake,,,,I need a good kicking..hi

Great fast response...onward we go

Cheers

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top