|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL WHERE clause help
Hello all, I have a small problem.
I have an SQL statement in a PHP page, with this as part of the WHERE clause. (rl.nameE = '% $res %' OR '%$res' OR '$res%' OR '$res' OR '% $res' OR '$res %') This pulls up from my database everything that has contains the keyword INSIDE the field (but not when the keyword is the first or last word). My goal here is to try to eliminate all the junk I get in my search when I open it up all the way example search: Eric -> american etc..... Can anyone see something wrong, or suggest a solution for my query? thanks in advance. KrazyKoder. |
|
#2
|
||||
|
||||
|
with $res = eric and '***' any text/char:
'% $res %' gives: '*** eric ***' '%$res' gives: '***eric' '$res%' gives: 'eric***' '$res' gives: 'eric' '% $res' gives: '*** eric' '$res %' gives: 'eric ***' |
|
#3
|
|||
|
|||
|
thanks for the reply, I found my error.
the logic I was looking for was rather: WHERE (rl.nameE LIKE '$res %') OR (rl.nameE LIKE '% $res %') OR (rl.nameE LIKE '% $res') OR .... and so on. KrazyKoder. |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL WHERE clause help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|