mysql - for loop always returning output 4444 instead of 1111 in php -



mysql - for loop always returning output 4444 instead of 1111 in php -

for($i =0; $i <$firstcounter; $i++) { //echo $firstresultarray[$i]['startdatetime']; $query1 = "select p.placeid,p.placename placename,p.location,p.address placeaddress,p.latitude,p.longitude,p.starrating placerating,d.dealno,d.dealtitle,d.minpersons,d.maxpersons,d.price dealprice,d.typeofdeal,d.url placeimg,d.pricerange, d.placeid,t.startday,t.endday,t.dealno,t.startdatetime,t.enddatetime places p inner bring together dealdetails d on p.placeid = d.placeid inner bring together dealtime t on t.dealno = d.dealno d.typeofdeal='".$businesstype."' , d.minpersons between 1 , 3 , '".$firstresultarray[$i]['startdatetime']."' <= '" .$datetime."' , '".$firstresultarray[$i]['enddatetime']."' > '" .$datetime ."' order placedistance"; $result1 = mysql_query($query1); //echo "result: "+ $result; $num_rows = mysql_num_rows($result1); echo $num_rows; }

echo numrows returning 4 instead of one. output 4444. dont knw why? can help plz?

mysql_num_rows() returns count of rows found. query must returning 4 thats why printing 4444.

you should not utilize mysql deprecated in newer varsions. utilize mysqli or pdo instead.

php mysql

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -