select distinct like problems
Posted: Mon Mar 31, 2008 2:56 am
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
this is my code: it's a search suggest type feature. I'm using the javascript alert() command to display what this returns. This code here returns quotation marks if it find something in the database, otherwise it returns nothing. i can't get it to display what it really is finding.
My php knowledge is patchy at best.
Any help is greatly appreciated.
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
this is my code: it's a search suggest type feature. I'm using the javascript alert() command to display what this returns. This code here returns quotation marks if it find something in the database, otherwise it returns nothing. i can't get it to display what it really is finding.
Code: Select all
if (isset($_GET['search']) && $_GET['search'] != '') {
$search = addslashes($_GET['search']);
$suggest_query = db_query("SELECT distinct payee FROM transactions WHERE payee like '%".$search."%' ORDER BY payee");
while($suggest = db_fetch_array($suggest_query)) {
echo $suggest['suggest'] . "\n";
}
}Any help is greatly appreciated.
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: