![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Ls, I want to make a select query. This query has to match on column x like: SELECT * FROM `table` WHERE `column` LIKE %value% I only get some of the results I want because the `table` column has "unwanted" characters in it. In PHP I could strip the unwanted characters like this: $table = preg_replace("/\W/", "", $table); So I thought I could do something like: SELECT * FROM `table` WHERE preg_replace("/\W/", "", `column`) LIKE %value% But with the php code converted to "MySQL code". Unfortunatally this has proven to difficult for this (almost) stupid noob. Could anyone of you help me with the select query? |
| Alexander |
#3
| |||
| |||
|
|
In article <8546a170-a6b2-41fa-ab58-cc0db891d... (AT) j25g2000yqa (DOT) googlegroups..com>, Electricdummy <electricdu... (AT) hotmail (DOT) com> wrote: Ls, I want to make a select query. This query has to match on column x like: SELECT * FROM `table` WHERE `column` LIKE %value% I only get some of the results I want because the `table` column has "unwanted" characters in it. In PHP I could strip the unwanted characters like this: * *$table = preg_replace("/\W/", "", $table); So I thought I could do something like: SELECT * FROM `table` WHERE preg_replace("/\W/", "", `column`) LIKE %value% But with the php code converted to "MySQL code". Unfortunatally this has proven to difficult for this (almost) stupid noob. Could anyone of you help me with the select query? Perhaps if you'd be good enough to explain: 1. What you've already tried 2. What happens when you try it 3. What, exactly, are the "unwanted characters" you need to ignore, and where do they occur? |
#4
| |||
| |||
|
|
I want to make a select query. This query has to match on column x like: SELECT * FROM `table` WHERE `column` LIKE %value% I only get some of the results I want because the `table` column has "unwanted" characters in it. In PHP I could strip the unwanted characters like this: $table = preg_replace("/\W/", "", $table); So I thought I could do something like: SELECT * FROM `table` WHERE preg_replace("/\W/", "", `column`) LIKE %value% But with the php code converted to "MySQL code". Unfortunatally this has proven to difficult for this (almost) stupid noob. |
![]() |
| Thread Tools | |
| Display Modes | |
| |