Page 1 of 1

Search Query error

Posted: Thu Sep 16, 2010 12:57 am
by selvaganesh87
Am learning PHP while learning i tried a concept to retrieve the data from server through PHP but i get some error i can't find it. I made a search box in HTML front end, and the back end PHP coding is made to retrieve the result from MYSQL server buy while searching from search box i get an 404 error not found. Any body here hep me to make it work
Here is my coding that i used

HTML CODING
<HTML>
<HEAD>
<TITLE>SERARCH ITEMS IN SHOP</TITLE>
</HEAD>
<BODY>
<FORM ACTION="DepartmentalStoreSearch.php" METHOD="POST">
<H3>Search for Your Product<H3><BR>
<input NAME="products" TYPE=TEXT>
<input TYPE=SUBMIT value="search">
</FORM>
</BODY>
</HTML>

PHP CODING

<HTML>
<HEAD>
<TITLE>FANCY PRODUCTS</TITLE>
</HEAD>
<BODY>
<?
$products = $_POST['products'];
$db = mysql_connect("localhost");
mysql_select_db("deptstore", $db);
$query = ("select storeproducts.PID, storeproducts.Pname, storeproducts.Tprice from storeproducts WHERE Pname LIKE '%$products%' ");
$result = mysql_query($query);
while($items = mysql_fetch_assoc($result)) {
while(list($sproductss, $spricess) = each($items)) {
echo $sproductss. ":" .$spricess. "<BR>";
}
}
?>
</BODY>
</HTML>

Re: Search Query error

Posted: Thu Sep 16, 2010 1:58 am
by requinix
Did you name the PHP script DepartmentalStoreSearch.php? Are sure it doesn't have a .txt or .html extension?

Re: Search Query error

Posted: Thu Sep 16, 2010 5:10 am
by selvaganesh87
Thank u PHP guys i again renamed the php file with the name i given in HTML file, but i already given the same name but again i replaced out of luck and your guidance it is working. Thank you guys to spend your effort to make me understand