php-db | 2004071
Date: 07/01/04
- Next message: Pablo M. Rivas: "Re: [PHP-DB] More problems with searching"
- Previous message: Shiloh Madsen: "[PHP-DB] More problems with searching"
- In reply to: Shiloh Madsen: "[PHP-DB] More problems with searching"
- Next in thread: Pablo M. Rivas: "Re: [PHP-DB] More problems with searching"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 1 Jul 2004 12:28:46 -0500, Shiloh Madsen
<shiloh_madsen <email protected>> wrote:
>
> After the very kind help i was given last night I have the query being built
> right, however the query does not work. Just to refresh, the gentlemen who
> had helped me suggested creation of a query that looks like:
>
> SELECT * FROM table1 where 1 or cat or dog...and so forth. Now, this query
> is building fine, but the where 1 is causing it to return rows even if it
> has none of the search terms. When i run it in sql without the where 1 it
> works as it should, but with that, i get all rows returned. Is there a way i
> can reword this query or am I doing something wrong?
>
> this was Mr Holmes's solution (in part):
> $query = "SELECT * FROM keyword WHERE 1 "
> $words = explode(' ',$_GET['search_text']);
> foreach($words as $word)
> { $query .= " AND keyword = '$word' "; }
Shouldn't that be OR?
>
> Ideas?
>
> Shiloh
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40e4480b265025655517531!
>
>
-- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilderpaperCrane --Justin Patrin--
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Pablo M. Rivas: "Re: [PHP-DB] More problems with searching"
- Previous message: Shiloh Madsen: "[PHP-DB] More problems with searching"
- In reply to: Shiloh Madsen: "[PHP-DB] More problems with searching"
- Next in thread: Pablo M. Rivas: "Re: [PHP-DB] More problems with searching"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

