SEARCHING for an answer...

From: Date: Tue, 11 Sep 2007 17:15:37 +0000
Subject: SEARCHING for an answer...
Groups: php.general 
Request: Send a blank email to php-general+get-261953@lists.php.net to get a copy of this message
Hi Everyone :) I am attempting to add the ability to search a online database, and I thought that I have the code right, but apparently it's not... Here's the problem, when I type jason in the search box and hit go it brings me to edit.php?search=jason which displays nothing since edit.php is looking for a record number, not a search phrase... The end result I want, is that someone could search for "jason" and have it display ONLY the results having "Jason" in them on the same page. Simple right? Well my brain seems to be on vacation! :) Here is the relevant code (I think...) $search = $_GET["search"]; $self = $_SERVER['PHP_SELF']; $qstring = "SELECT * FROM current WHERE FName like '%$qstring%' or LName like '%$qstring%' or Add1 like '%$qstring%' or Add2 like '%$qstring%' or City like '%$qstring%' or State like '%$qstring%' or Zip like '%$qstring%' or XCode like '%qstring%'"; if ($search != NULL){ echo "The search string is: <strong>$search</strong>.<BR>"; $qresult= mysql_query($link, $qstring); echo "Query completed"; } else { echo (' <form action="'.$self.'" method="get"> <label>Search: <input type="text" name="search" id="search" /> </label> <input type="submit" value="Go!" /> </form> '); } -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.com

« previous php.general (#261953) next »