[ Milos911 @ 21.10.2011. 10:10 ] @
| Navikao sam da radim ovako:
Code: mysql_query("SELECT blablabla");
if(mysql_affected_rows()>0){
something is found, proceed
}else{
nothing is found
}
Manual kaze
Citat: Note: SELECT Statements
To retrieve the number of rows returned by a SELECT, it is possible to use mysql_num_rows().
Meni mysql_affected_rows() uvek, ali uvek vraca >0 ako je nesto nadjeno. A koristim ga bas mnogo. Sad, zanima me koliko je pogresno ovo raditi, i da li ima bolji nacin za proveru da li je nesto nadjeno u bazi od ovog mog koda? |
[ VladaSu @ 21.10.2011. 15:03 ] @
1.
int mysql_affected_rows ([ resource $link_identifier ] )
Get the number of affected rows by the last INSERT, UPDATE, REPLACE or DELETE query associated with link_identifier.
2.
int mysql_num_rows ( resource $result )
Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows().
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.