I have created a database with table. I created my webpages using recordsets in Dreamweaver. I am now trying to integrate a search into my site.
Here is my search code on my index page:
Code: Select all
<td width="99%" rowspan="2" align="center"><form action="results.php" method="post" name="area" id="area">
<input name="area" type="text" id="area">
<input type="submit" name="Submit" value="Submit">
</form> </td>On my results page here is the code:
Code: Select all
<?php require_once('Connections/Aiph.php'); ?>
<?php
{
echo("<font face="tahoma" size="3" color="green"><b>Results for $words</b></font><br><br>");
$location = "*******"; // database host (localhost)
$username = "*****"; // mysql username
$password = "*****"; //mysql password
$database = "*****"; //mysql database name
$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];
$sql = mysql_query("SELECT CityArea, FROM 'restaurant' WHERE CityArea LIKE %$area% ") or die (mysql_error());
?>
}
$maxRows_Recordset5 = 5;
$pageNum_Recordset5 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset5'])) {
$pageNum_Recordset5 = $HTTP_GET_VARS['pageNum_Recordset5'];
}
$startRow_Recordset5 = $pageNum_Recordset5 * $maxRows_Recordset5;
mysql_select_db($database_Aiph, $Aiph);
$query_Recordset5 = "$sql";
$query_limit_Recordset5 = sprintf("%s LIMIT %d, %d", $query_Recordset5, $startRow_Recordset5, $maxRows_Recordset5);
$Recordset5 = mysql_query($query_limit_Recordset5, $Aiph) or die(mysql_error());
$row_Recordset5 = mysql_fetch_assoc($Recordset5);
if (isset($HTTP_GET_VARS['totalRows_Recordset5'])) {
$totalRows_Recordset5 = $HTTP_GET_VARS['totalRows_Recordset5'];
} else {
$all_Recordset5 = mysql_query($query_Recordset5);
$totalRows_Recordset5 = mysql_num_rows($all_Recordset5);
}
$totalPages_Recordset5 = ceil($totalRows_Recordset5/$maxRows_Recordset5)-1;Ok the problem I am having is it does not work.
This is the live site:stu.aii.edu/~anl183/php/index.php
I want to preserve the look of my site so I am not sure what to do.
As I have said I am new at PHP and I am sure that there is a massive mistake I have made. I apologize in advance for my ignorance. I have tried to read tutorials, and the PHP guide but I am not grasping the situation.
Thanks for anyone's help.
Nicole
feyd | swapped
Code: Select all
intoCode: Select all
tag.[/color]