This is a discussion on "MySQL query query" within the Databases section. This forum, and the thread "MySQL query query are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
MySQL query query
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
MySQL query query
Hello
I'm creating a search engine for my site and i want to use the following query to search the database: $query = "SELECT * FROM accessories WHERE category = '$category' AND code LIKE '%$search%' OR name LIKE '%$search%' OR description LIKE '%$search%'"; This doesnt seem to work! I can get his to work: $query = "SELECT * FROM accessories WHERE category = '$category'"; and I can get this to work: $query = "SELECT * FROM accessories WHERE code LIKE '%$search%' OR name LIKE '%$search%' OR description LIKE '%$search%'"; I just cant combine the two queries to make the larger first one. The AND seems to break the query. Is this possible? Only way I can think of getting round this is making another table and doing a join but that seems excessive. Is this a limitation of MySQL or can some one point me in the right direction. Thanks |
|
|
|
#2
|
|||
|
|||
|
Re: MySQL query query
Have you tried something like this?
|
|
#3
|
|||
|
|||
|
Re: MySQL query query
Gah!
Brackets. Doh Cheers karinne |
|
#4
|
|||
|
|||
|
Re: MySQL query query
It worked? Ah .... cool!
|
![]() |
| Tags |
| mysql multiple |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Mysql Query not working | nate2099 | Databases | 13 | Jan 3rd, 2008 02:28 |
| MYSQL/PHP Query question | andrewlondon | Databases | 1 | Sep 19th, 2007 11:26 |
| MYSQL PHP query class | jhappeal | Databases | 1 | Aug 17th, 2007 01:52 |
| Returning a value from a MYSQL Query? | Kimochi | PHP Forum | 7 | Feb 28th, 2007 20:09 |
| mysql query in a function | Redempt1on | PHP Forum | 6 | May 19th, 2006 01:25 |