Code will not work
Posted: Mon Mar 29, 2004 5:45 am
Still trying to get code to work if anyone can tell me the problem ...thanks in advance.
Search Page coded in HTML!
<html>
<head><title>Bookday & Week Search</title></head>
<body>
<br><br>
<h1 align="center" h1><b><FONT COLOR="black">FIND THE RIGHT TIME TO FLY!!</b></font></h1>
<body background="http://images.google.com/images?q=tbn:H ... far/flying">
<div align="center"><center>
<br>
<table border="2" cellspacing="0" width="700">
<tr>
<td align="center" width="700" bgcolor="#00FFFF"><h1
align="center" h1><b>Search by Bookday And Week No.</b></h1>
</td>
</tr>
<tr>
<form action=""bookday&weeknoresults.php" method="post">
<td align="center" valign="top" bgcolor="#66FFFF"
height="67"><p align="center">Select Bookday & Week Number from the Search Lists.
<br> Then Press the Search Button</p>
</td>
</tr>
<tr>
<td height="308" bgcolor="#66FFFF">
<form action=""bookday&weeknoresults.php" method="post">
<br>
<center><h3>Select Bookday:</h3>
<br></center>
<center>Bookday;
<select name="bookday">
<option value="sunday">Sunday</option>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
</select>
<br><br>
<center>Week Number;
<select name="weekno">
<option value="1">Week 1</option>
<option value="2">Week 2</option>
<option value="3">Week 3</option>
<option value="4">Week 4</option>
<option value="5">Week 5</option>
</select>
<br><br>
<input type=submit value="search">
</center>
</form>
</td>
</tr>
</table>
</center></div>
</body>
</html>
________________
Results Page in PHP
<html>
<head>
<title>Bookday & Week Results</title>
<body bgcolor="blue">
<h1 align="center"><em>Bookday & Week Results</em></font><h1>
<?
$user = "";
$db = "";
$link = mysql_connect("",$user);
if(! $link)
die("could not connect to MySQL");
print "Successfully conected to Server<p>";
//Connect to database
mysql_select_db($db:, $link)
or die ("Couldn't open $db: ".mysql_error() );
//Run Query for search
$sql = "select destinationfrom,destinationtill,price,bookday,weekno
from flights,flightprices where flights.flightid=flightprices.flightid
and flights.flyday=flightprices.flyday and flightprices.bookday='$_POST[bookday]'
and flightprices.weekno='$_POST[weekno]';";
//Count Results
$query = mysql_query($sql);
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
if ($num_results == 0) {
echo"<p><strong>No Results Found.<br>Please Try Again</strong></p>";
}
else {
echo"<strong>You Searched for: '$_POST[bookday]' & '$_POST[weekno]'</strong></p>";
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
}
}
?>
Search Page coded in HTML!
<html>
<head><title>Bookday & Week Search</title></head>
<body>
<br><br>
<h1 align="center" h1><b><FONT COLOR="black">FIND THE RIGHT TIME TO FLY!!</b></font></h1>
<body background="http://images.google.com/images?q=tbn:H ... far/flying">
<div align="center"><center>
<br>
<table border="2" cellspacing="0" width="700">
<tr>
<td align="center" width="700" bgcolor="#00FFFF"><h1
align="center" h1><b>Search by Bookday And Week No.</b></h1>
</td>
</tr>
<tr>
<form action=""bookday&weeknoresults.php" method="post">
<td align="center" valign="top" bgcolor="#66FFFF"
height="67"><p align="center">Select Bookday & Week Number from the Search Lists.
<br> Then Press the Search Button</p>
</td>
</tr>
<tr>
<td height="308" bgcolor="#66FFFF">
<form action=""bookday&weeknoresults.php" method="post">
<br>
<center><h3>Select Bookday:</h3>
<br></center>
<center>Bookday;
<select name="bookday">
<option value="sunday">Sunday</option>
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
</select>
<br><br>
<center>Week Number;
<select name="weekno">
<option value="1">Week 1</option>
<option value="2">Week 2</option>
<option value="3">Week 3</option>
<option value="4">Week 4</option>
<option value="5">Week 5</option>
</select>
<br><br>
<input type=submit value="search">
</center>
</form>
</td>
</tr>
</table>
</center></div>
</body>
</html>
________________
Results Page in PHP
<html>
<head>
<title>Bookday & Week Results</title>
<body bgcolor="blue">
<h1 align="center"><em>Bookday & Week Results</em></font><h1>
<?
$user = "";
$db = "";
$link = mysql_connect("",$user);
if(! $link)
die("could not connect to MySQL");
print "Successfully conected to Server<p>";
//Connect to database
mysql_select_db($db:, $link)
or die ("Couldn't open $db: ".mysql_error() );
//Run Query for search
$sql = "select destinationfrom,destinationtill,price,bookday,weekno
from flights,flightprices where flights.flightid=flightprices.flightid
and flights.flyday=flightprices.flyday and flightprices.bookday='$_POST[bookday]'
and flightprices.weekno='$_POST[weekno]';";
//Count Results
$query = mysql_query($sql);
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
if ($num_results == 0) {
echo"<p><strong>No Results Found.<br>Please Try Again</strong></p>";
}
else {
echo"<strong>You Searched for: '$_POST[bookday]' & '$_POST[weekno]'</strong></p>";
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
}
}
?>