Jump to content

Mysql query


daydreamer

Recommended Posts

How can I get the latest insert of a certain record in mysql.

 

example table:

id    user  date 

1    smokey  ... 

2    Jsmith  ... 

3    Blondy  ... 

4    dexter  ... 

5    Blondy  ... 

6    tt  ... 

 

I am after row id:5 user:Blondy only.

 

I could do this:

$last = mysql_query("SELECT * FROM members
                           WHERE user='Blondy' ") or die (mysql_error());

then get the biggest ID and thats the row i need, but im sure there is a way to do it in one mysql query?

 

Thanks any help appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/133705-mysql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.