Hi I want to create a search bar where users inputs their search criteria, it then search for a match in the database and output the results if any else, say there was no match.
I have written this code so far but for some reason, nothing is being displayed. It does get the search criteria from the form, so that part is fine. Please help
<?php
if (!$conn = new COM("ADODB.Connection"))
exit("Unable to create an ADODB connection");
$strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("product.mdb");
$conn->open($strConn);
$submit = $_POST['submit'];
$criteria = $_POST['criteria'];
if(isset($submit))
{
// SQL statement to build recordset.
$query = $conn->Execute("SELECT * FROM products WHERE product_name='".$criteria."'");
$result = mysql_query ($query, $conn);
$numrows = msql_num_rows ($result);
$myrow = mysql_fetch_array($result);
if(!$numrows)
{
die('Gizmerror!! Either you have typed your USERNAME and or Your PASSWORD incorrectly or you have not registered to access this pages. <p><font color="red" size="+1"><center> Please Try Again</center> </font></p>');
}
else {
die ("Your Search Result Returned <p><hr><br> $result");
}
}
?>
I GET THE FOLLOWING ERROR
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in e:\webareas\ou301\project\search.php on line 17
Fatal error: Call to undefined function: msql_num_rows() in e:\webareas\ou301\project\search.php on line 18