php - MySQL: Num Rows not working -


i've stumbled upon simple mysql error, , seems attempts of fixing effortless. problem, it's not counting.

before go further, know mysql_* deprecated, , shouldn't use it. should use mysqli_* or pdo.

this query, , yes, echo testing.

$ms_sql = mysql_query("select * mijnsp sp_username = '".$user['username']."'");     while ($mijnspusers = mysql_fetch_assoc($ms_sql)) {      $ms_count = mysql_num_rows($ms_sql);      if($ms_count <= 0){         echo "result empty";     }else{         echo $mijnspusers['new_username'];     } 

i've tried change if, no effect;

if($ms_count <= "0"){ 

or, this

if($ms_count <= '0'){ 

thank in advance, pascal

call

$ms_count = mysql_num_rows($ms_sql); 

before while() loop.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -