i have this error :
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/local/apache/login/clockout.php on line 82
$query = "select * from tbl where userName = '$user' and timeid >= (LAST_UPDATE_ID())";
$result = mysql_query($query);
//while($nt=mysql_fetch_array($result)){
while($nt=mysql_fetch_array($result)){
echo......
when i use LAST_INSERT_ID its ok but it displays all the query, i have to display the last updated row only, anyone can help...
thansk!
query error
Moderator: General Moderators
-
thegreatone2176
- Forum Contributor
- Posts: 102
- Joined: Sun Jul 11, 2004 1:27 pm
- smpdawg
- Forum Contributor
- Posts: 292
- Joined: Thu Jan 27, 2005 3:10 pm
- Location: Houston, TX
- Contact:
LAST_UPDATE_ID() returns the last row number that was updated. What datatype is timeid in the database? Is it an integer that is autoincrementing or is it time related as the name implies?
In the meantime, try this.
edit - My bad. I got it mixed in my head with LAST_INSERT_ID()
In the meantime, try this.
Code: Select all
$query = "select * from tbl where (userName = '$user') and (timeid >= LAST_UPDATE_ID())";
Last edited by smpdawg on Wed Mar 02, 2005 11:14 pm, edited 1 time in total.
query error
sirs,
timeid is an auto incrementing integer....
timeid is an auto incrementing integer....
query error
but why is it when i use LAST_INSERT_ID it displays all contents of the database which satisfies the condition, is there any function that will only display the last updated row...
or better yet instead of using the function, how can i just define the value of the timeid into a variable so that ican define it as :
$query = "select * from tbl where userName = '$user' and timeid = '$timeid'";
would this be possible??
thansk!
or better yet instead of using the function, how can i just define the value of the timeid into a variable so that ican define it as :
$query = "select * from tbl where userName = '$user' and timeid = '$timeid'";
would this be possible??
thansk!