Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2005, 03:40 AM
Registered User
 
Join Date: Jun 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default php search engine

hi all,

i am having some problem with my search engine which i couldn't solve. whenever i keyed in a key word to search from my database but it just couldn't get the result(s) and just die off.

the final output for my result is:

couldn't execute query

when my code looks like this:

<?
mysql_connect("localhost","pbl_b","abtV7QKL5aRNI") ;

mysql_select_db("pbl_b");

$search=$_POST["SearchEngine"];

$result = mysql_query("SELECT * FROM search WHERE Desc LIKE '%$search%'") or die("couldn't execute query");

while($r=mysql_fetch_array($result)){
        $title = $r['Title'];
        $desc = $r['Desc'];
        $link = $r['Link'];

}


?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><h1>Result</h1><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY>
<p align ="Center"> The Keywords is <strong><? $_POST['SearchEngine'] ?> </strong>.</p></p>
<tr><td>&nbsp;</td>
</tr>
<tr><td>&nbsp;</td><td><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>

                 <? echo "$_POST[Title] ";?> <br>
                 <? echo "$_POST[Desc]"; ?><br>
                 <? echo "$_POST[Link]"; ?><br>
            </td>
    </tr>
  </table></td></tr>
<tr><td></td><td></td><td></td></tr>

</BODY></HTML>


all the naming for the fields are corrent from the html and the database. please tell me where the problem lies.

thanx






Similar Threads
Thread Thread Starter Forum Replies Last Post
search engine iralala ASP.NET 2.0 Basics 6 September 18th, 2008 04:26 AM
search engine dhoward SQL Server 2000 4 April 11th, 2007 12:42 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search Engine in PHP chvol BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 February 13th, 2004 03:15 PM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.