Php Search
Posted: Thu Nov 28, 2002 7:51 am
I'm a newbie trying to make a search engine, but after I submit the form it says that there is something wrong with line 47, could anyone help me with this please 
This is line 47: while ($row = mysql_fetch_object ($query_result))
There might be more errors here

This is line 47: while ($row = mysql_fetch_object ($query_result))
Code: Select all
<?php require_once('../Connections/cds.php'); ?>
<?php
$db_connection = mysql_connect($hostname_cds , $username_cds , $password_cds) or die ("Could not connect to database");
mysql_select_db ($database_cds , $db_connection) or die ("Could not find database")
?>
<?php
/* HEADER STUFF*/
print "<title>Search Results</title>";
print "<link href="../style.css" rel="stylesheet" type="text/css">";
/* TABLE #1 */
print "<table width="100%" align="center" cellpadding="5" cellspacing="0">";
print "<tr>";
print "<td width="50%" class="small">Search Results for $search </td>";
print "<td width="50%" align="right"><a href="javascript:history.back()" onclick="history.back();return false">їBack]</a></td>";
print "</tr>";
print "<tr>";
print "<td height="25" colspan="2" class="small"></td>";
print "</tr>";
print "<tr align="center">";
print "<td colspan="2" class="small">";
/* TABLE #2 */
print "<table width="100%" border="0" cellspacing="0" cellpadding="0">";
print "<tr bgcolor="#FF0000">";
print "<td width="60%">Title</td>";
print "<td width="20%">CD</td>";
print "<td width="20%">Category</td>";
print "</tr>";
if (($search == "") || ($search == " "))
{
print ("Don't you try be a smart ass again, ok?");
exit;
}
if (($search <> "") || ($search <> " "))
$category_query = "SELECT * FROM cd, sw, cat WHERE (sw.sw_title like "$search%")
AND (sw.cat_id = "$cat" )
AND (sw.cd_id = cd.cd_id) ORDER BY (sw.sw_title "$radDirection")";
$query_result = mysql_query ($category_query, $db_connection) or die("There's some spooky monkey business going on..");
while ($row = mysql_fetch_object ($query_result))
{
print "<tr>";
print "<td>" . $row->sw_title . "</td>";
print "<td>" . $row->cd_title . "</td>";
print "<td>" . $row->cat_title . "</td>";
print "</tr>";
}
/* TABLE #1 */
print "<tr align="center">";
print "<td colspan="2"></td>";
print "</tr>";
print "</table>";
?>
<?php
mysql_close($db_connection);
?>