<?php    echo"<link rel=\"stylesheet\" type=\"text/css\" href=\"/computer/css/index.css\" />";
echo "<link href=\"index.css\" type=\"text/css\" rel=stylesheet />";

    include("head.html");
    include("dbinfo.inc.php");

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//echo "连接成功!";
mysql_query("SET NAME 'UTF8'"); 
mysql_query("SET CHARACTER SET UTF8"); 
mysql_query("SET CHARACTER_SET_RESULTS=UTF8'"); 
    
    $brand = $_GET['brand'];
    //echo "$brand";
if($brand == null){

showLaptops("hp");
  echo "1111111";
} else {
   showLaptops($brand);     };

function showLaptops($brand){

    

    $query = "SELECT * FROM laptops WHERE name like '"+$brand+"%'";
     
    $result=mysql_query($query);
$num = mysql_num_rows($result);
mysql_close(); echo "<b><center>Laptop Database Output</center></b><br><br>"; $i = 0;

while ($i < $num) { $name=mysql_result($result,$i,"name");
$price=mysql_result($result,$i,"price");
$time=mysql_result($result,$i,"time");
$img=mysql_result($result,$i,"img");
$weight=mysql_result($result,$i,"weight");

echo "<div class=\"laptop_container\">

<div class=\"laptop_img_container\"><img src=\"/computer/images/$img\"></img></div>

<div class=\"laptop_content\">

<ul><li>name:$name</li>
  <li>price: $price</li>
  <li>time: $time</li>
  <li>weight: $weight</li>
</ul>
</div>                              

  </div>";
$i++;
}

}

    echo " <div class=\"index_menu_container\">
            <ul>
<li id=\"index_button_hp\"><a class=\"container_hp\" href=\"index.php?brand=hp\" ><span>HP</span></a></li>
<li id=\"index_button_apple\"><a class=\"container_apple\" href=\"index.php?brand=apple\" ><span>APPLE</span></a></li>
<li id=\"index_button_lenovo\"><a class=\"container_lenovo\" href=\"index.php?brand=lenovo\" ><span>LENOVO</span></a></li>
<li id=\"index_button_hasee\"><a class=\"container_hasee\" href=\"index.php?brand=hasee\" ><span>HASEE</span></a></li>
<li id=\"index_button_dell\"><a class=\"container_dell\" href=\"index.php?brand=dell\" ><span>DELL</span></a></li>
</ul>  
            </div> "; include("foot.html");

?>  Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\www\computer\index.php on line 38 就是这行 $num = mysql_num_rows($result);