why this sql code dont work

Posted by magy on Stack Overflow See other posts from Stack Overflow or by magy
Published on 2010-06-09T09:52:59Z Indexed on 2010/06/09 10:02 UTC
Read the original article Hit count: 231

Filed under:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>??? ?????? ???? ????</title>
</head>

<body>
<table width="100%" border="1">
 <tr>
    <td>name</td>
    <td>number</td>
    <td>math</td>
    <td>arab</td>
    <td>history</td>
    <td>geo</td>

  </tr>


<?php


require_once "conf.php";

$sql2=("SELECT * FROM student WHERE snum = $ss");
$rs2 = mysql_query($sql2) or die(mysql_error());
$num = mysql_num_rows($rs2);
$ss= $_POST["ss"];

if (empty($ss))
{ echo "please write your search words";}
else if ($num < 1 )   {
   echo  "not found any like ";

}else {
$sql=("SELECT * FROM student WHERE snum = $ss ");
$rs = mysql_query($sql) or die(mysql_error());



while($data=mysql_fetch_array($rs)){
$name=$data["sname"];
$number=$data["snum"];
$math=$data["math"];
$arab=$data["arab"];
$history=$data["history"];
$geo=$data["geo"];





echo"
  <tr>
    <td>$name</td>
    <td>$number</td>
    <td>$math</td>
    <td>$arab</td>
    <td>$history</td>
    <td>$geo</td>
  </tr>
";


}
 };
?>
 </table>
</body>
</html>

© Stack Overflow or respective owner

Related posts about php