Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

mysql_affected_rows() or mysql_num_rows() for select statment

[es] :: PHP :: PHP za početnike :: mysql_affected_rows() or mysql_num_rows() for select statment

[ Pregleda: 1106 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Milos911
Serbia

Član broj: 219127
Poruke: 1230
77.243.20.*



+303 Profil

icon mysql_affected_rows() or mysql_num_rows() for select statment21.10.2011. u 10:10 - pre 152 meseci
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?
 
Odgovor na temu

VladaSu

Član broj: 31634
Poruke: 1099
*.dynamic.isp.telekom.rs.



+218 Profil

icon Re: mysql_affected_rows() or mysql_num_rows() for select statment21.10.2011. u 15:03 - pre 152 meseci
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().
[Ovu poruku je menjao VladaSu dana 14.06.2003. u 11:22 GMT+1]
 
Odgovor na temu

[es] :: PHP :: PHP za početnike :: mysql_affected_rows() or mysql_num_rows() for select statment

[ Pregleda: 1106 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.