php - Enable - Disable Table Result -


i making phone directory school project , yet work far. want hide table header (last name, first name, etc) view after got result. before search. header view(i want hide it)

after search. want view header

this images before , after search names , here codes:

    <table class="gridtable">     <th>last name</th>     <th>first name</th>     <th>address</th>     <th>telephone number</th>     <th>network</th>     <th>something wrong?</th> 

this table header

include 'database.php';  $lname = ""; $fname = "";  if(isset($_post['lname'])  || (isset($_post['fname']))){ $fname = $_post['fname'];     $lname = $_post['lname']; }  if(!isset($_post['fname']) || ($_post['lname'])) ;  $vars = array('lname'); $verified = true; foreach($vars $v) { if(!isset($_post[$v]) || empty($_post[$v])) {   $verified = false; } } if(!$verified) { exit(); }   $result = mysql_query("select * sheet1 lname '%$lname%' , fname     '%$fname%' "); 

here echo results

if($count = mysql_num_rows($result)){   echo "<p class=\"count\"> <b>$count </b> results  <b><i>\" $lname $fname \"</i></b>   </p>"; } else  echo "<p class=\"count\"> no result - <b><i>\" $lname $fname  \"</i></b></p>";  while(@$row = mysql_fetch_array($result)){ echo  "<tr>" . "<td><b>" . $row['lname'] . "</b></td>" . "<td><b>" . $row['fname'] . "</td>" . "<td>" . $row['address'] . "</td>" . "<td>" . $row['telnum'] . "</td>" . "<td>" . $row['network'] . "</td>" . "<td>" .  "<input type = \"submit\" value= \"report\" class= \"classname \" name= \"report\">" .  "</tr>";    } ?> 

you need put table in condition

if(mysql_num_rows($result) > 0) { //process if sql returns more 0 rows    //table code here } 

warning: using mysql_() deprecated, consider using mysqli_() or pdo instead.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -