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="#E1E1E 1">
<td width="246">Eve nts</td>
<td width="246">Cou ntryname</td>
<td width="215">Dat e</td>
<td width="217">Mon th</td>
<td width="194">Yea r</td>
</tr>
<?PHP
include('connec t.php');
if($_POST['Submit'])
{
$edit="select * from addevent where date='$_POST[date]' AND month='$_POST[month]'";
echo $edits=mysql_qu ery($edit);
//$row = mysql_fetch_row ($edits);
$number = mysql_num_rows( $edits);
while ($rows=mysql_fe tch_assoc($edit s))
{
print "<tr bgcolor=\"#CCCC CC\">
<td bgcolor=\"#FFFF FF\">" . $rows['event'] ."</td>
<td bgcolor=\"#FFFF FF\">" .$rows['countryname'] ."</td>
<td bgcolor=\"#FFFF FF\">" .$rows['date'] . "</td>
<td bgcolor=\"#FFFF FF\">" .$rows['month'] . "</td>
<td bgcolor=\"#FFFF FF\">" . $rows['year'] . "</td>
</tr>";
}
echo"<B>Totally $number events are found</B><br>";
}
//var_dump(($_POS T['date'])!=$edif['date']);
?>
</table>
<p> </p>
</form>
</html>
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="#E1E1E 1">
<td width="246">Eve nts</td>
<td width="246">Cou ntryname</td>
<td width="215">Dat e</td>
<td width="217">Mon th</td>
<td width="194">Yea r</td>
</tr>
<?PHP
include('connec t.php');
if($_POST['Submit'])
{
$edit="select * from addevent where date='$_POST[date]' AND month='$_POST[month]'";
echo $edits=mysql_qu ery($edit);
//$row = mysql_fetch_row ($edits);
$number = mysql_num_rows( $edits);
while ($rows=mysql_fe tch_assoc($edit s))
{
print "<tr bgcolor=\"#CCCC CC\">
<td bgcolor=\"#FFFF FF\">" . $rows['event'] ."</td>
<td bgcolor=\"#FFFF FF\">" .$rows['countryname'] ."</td>
<td bgcolor=\"#FFFF FF\">" .$rows['date'] . "</td>
<td bgcolor=\"#FFFF FF\">" .$rows['month'] . "</td>
<td bgcolor=\"#FFFF FF\">" . $rows['year'] . "</td>
</tr>";
}
echo"<B>Totally $number events are found</B><br>";
}
//var_dump(($_POS T['date'])!=$edif['date']);
?>
</table>
<p> </p>
</form>
</html>
Comment