Private Label and Cobranded VoIP Solutions
BrainCast internet & phone based message/memo recording & reminder organization system
Internet Phone Service and Broadband Phone Service by ViaTalk

Go Back   VoIP Forums, Internet Phone Service Forums, & Web Hosting Forums > CoderForums - Programming Discussion > General Programming Issues > Programming Languages & Technologies > PHP

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-01-2002, 04:34 PM
Quintopia Quintopia is offline
Registered User
 
Join Date: Dec 2001
Posts: 26
Database searching

The problem is at http://praetorian.quintopia.net/Members/members2.php. Everything works fine except the search feature never matches any rows, even when it should. (try searching for "Quin" or "Homu" which should match)

I had it display the exact query used and I don't know what's wrong with it. try it out.

The relevant code:
Code:
	  $searcher = "order by unique_id";
	  if (isset($search)) {
	    if (trim($searchterm) == "") {
		die("Invalid Search Term.  Please go back and try again.");
	    }
	    $searchterm = "'%".$searchterm."%'";
	    $searcher = "where $searchby like $searchterm";
	  }
	  if (isset($sort)) {
	    $searcher = "order by $sortby";
	  }
	  $query = "select * from members $searcher";
	  $result = mysql_query(addslashes($query));
	  if(!$result) {
	    if (isset($search)) {
		$content = "No matches found.  Please go back and try your search again.  QUERY: $query";
		require('../everypage.php');
		exit;
	    } else {
	      die("Failed to extract member table from database.  Try refreshing this page or come back later<BR>QUERY: $query");
	    }
	  }
As I said the displaying of data and the sort feature work fine, its only search queries that won't work. If you could help it would be appreciated.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump