why this condition not work i put the full code link plz help
- by migo
I've noticed that the first condition does not work
if (empty($ss)) {
echo "please write your search words";
}
but the second does
else if ($num < 1) {
echo "not found any like ";
full code
<?php
require_once "conf.php";
$ss= $_POST["ss"];
$sql2=("SELECT * FROM student WHERE snum = $ss");
$rs2 = mysql_query($sql2) or die(mysql_error());
$num = mysql_num_rows($rs2);
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)) {
?>
<div id="name">
<table align="center" border="3" bgcolor="#FF6666">
<tr>
<td><? echo $data ["sname"]." "."????? ??????"; ?></td>
</tr>
</table>
</div>
<div id="ahmed">
<table width="50%" height="50" align="center" border="2px" bgcolor="#BCD5F8">
<tr>
<td width="18%"><strong>???????</strong></td>
<td width="13%"><strong>?????</strong></td>
<td width="13%"><strong>?????</strong></td>
<td width="14%"><strong>????</strong></td>
<td width="12%"><strong>????</strong></td>
<td width="30%"><strong>??????</strong></td>
</tr>
<tr>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td><strong>?????? ????????</strong></td>
</tr>
<td><? echo $data['geo']; ?></td>
<td><? echo $data['snum']; ?></td>
<td><? echo $data['math']; ?></td>
<td><? echo $data['arab']; ?></td>
<td><? echo $data['history']; ?></td>
<td><strong>????? ??????</strong></td>
</tr>
<tr>
<td colspan="5" align="center" valign="middle">
<? $sum= $data['geo'] + $data['snum'] +
$data['math'] + $data['arab'] +
$data['history'];
echo $sum ;
?>
</td>
<td><strong>????? ???????</strong></td>
</tr>
<tr>
<td colspan="5" align="center">
<?
$all=500 ;
$sum= $data['geo'] + $data['snum'] +
$data['math'] + $data['arab'] +
$data['history'];
$av=$sum/$all*100 ;
echo $av."%" ;
?>
</td>
<td><strong>
?????? ???????
</strong></td>
</tr>
</table>
</tr>
</div>
<?
}
};
the full code link is
http://www.mediafire.com/?2d4yzdjiym0