Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
11-11-2011, 10:32 AM #1
- Join Date
- Feb 2010
- Thanked 0 Times in 0 Posts
Mysql select rows that hasnt been selected
Hi . I am building a live chat using mysql and the database is updated because of users entries . So the number ow rows in the table changes constantly . And need to use a query which will select the rows that hasnt been selected.
SO how do I do that ?
Thank you in advance!!!
11-11-2011, 07:45 PM #2
Put an auto_increment field in the table. Say it is named chatNumber
When you send the current messages out to a user, make sure the chatNumber values are included.
That is, your AJAX URL might be something like moreMessages.php?last=731
So in the PHP code, you just do
What could be simpler?Code:$sql = "SELECT * FROM chatMessages WHERE chatNumber > " . $_GET["last"]; ...
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.