php - Counting my array result -
i making search box, , want count result, try put count nothing happens.
$con = mysql_connect("localhost","root",""); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db("concatenate", $con); if($_post['lname'] != '' or $_post['fname'] != ''){ $searchq = $_post['lname']; $searchw = $_post['fname']; $result = mysql_query("select * sheet1 lname '%$searchq%' , fname '%$searchw%' ");
i hoping count result can't.
while($row = mysql_fetch_array($result)) { echo "<tr>" . "<td><b>" . $row['lname'] . "</b></td>" . "<td>" . $row['fname'] . "</td>" . "<td>" . $row['address'] . "</td>" . "<td>" . $row['telnum'] . "</td>" . "<td>" . $row['network'] . "</td>" . "<td>" . "<select class = \"report\">" . "<option value = \"wrong number\" >" . 'wrong number' . "</option>" . "<option value = \"discontinue\">" . 'discontinue' . "</option>" . "<option value = \"add number\">" . 'add number' . "</option>" . "<option value = \"change address\">" . 'change address' . "</option>" . "</select>" . "<input type = \"submit\" value= \"report\" class= \"classname \" name= \"report\">" . "</tr>"; } }
please me guys
after query execution make sure returns result. should not 0. can check printing line after mysql_query.
echo mysql_num_rows($result)
hope error.
Comments
Post a Comment