Hi,
Here is the script which i am working in this script i am trying to search some events for that i developed this .Its working but if there is no events means i want to display there is no event found like this in else part if i added like this
else
{
echo"No events found"
}
it wont consider that is else its displaying else part also from the begining so tell me in this script how to give else part.
<html>
<form name="form1" method="post" action="">
<p> </p>
<table width="200" border="0" align="center">
<tr>
<td>Select </td>
<td><?php
//here can give any range, even a to z, jan to dec etc
$a = range(01,31);
//var_dump($a);
echo'<select name="date">';
foreach($a as $date)
{
echo'<option>'.$date.'</option>';
}
echo'</select>';
$a = range(01,12);
//var_dump($a);
echo'<select name="month">';
foreach($a as $month)
{
echo'<option>'.$month.'</option>';
}
echo'</select>';
$a = range(2000,2010);
//var_dump($a);
echo'<select name="year">';
foreach($a as $year)
{
echo'<option>'.$year.'</option>';
}
echo'</select>';
?> </td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="Submit">
</p>
<p align="center"> </p>
<p align="center"> </p> <br>
<table width="900" border="0" align="center">
<div align="center"><b>Search Details</b></div>
<tr bgcolor="#E1E1E1">
<td width="246">Events</td>
<td width="246">Countryname</td>
<td width="215">Date</td>
<td width="217">Month</td>
<td width="194">Year</td>
</tr>
<?PHP
include('connect.php');
if($_POST['Submit'])
{
$edit="select * from addevent where date='$_POST[date]' AND month='$_POST[month]'";
echo $edits=mysql_query($edit);
//$row = mysql_fetch_row($edits);
$number = mysql_num_rows($edits);
while ($rows=mysql_fetch_assoc($edits))
{
print "<tr bgcolor=\"#CCCCCC\">
<td bgcolor=\"#FFFFFF\">" . $rows['event'] ."</td>
<td bgcolor=\"#FFFFFF\">" .$rows['countryname'] ."</td>
<td bgcolor=\"#FFFFFF\">" .$rows['date'] . "</td>
<td bgcolor=\"#FFFFFF\">" .$rows['month'] . "</td>
<td bgcolor=\"#FFFFFF\">" . $rows['year'] . "</td>
</tr>";
}
echo"<B>Totally $number events are found</B><br>";
}
//var_dump(($_POST['date'])!=$edif['date']);
?>
</table>
<p> </p>
</form>
</html>