Is it possible to use * as a wildcard for determining if a variable contains a certain word or number? I have attempted to do this but it didn't work, but then again I never do anything right.
* as a wildcard
Are you talking about PHP or MySQL? Is it important that it have to be the * or is it just what you believe?
In MySQL you can do like this to get the rows where 'variable' contains the character m.
In MySQL you can do like this to get the rows where 'variable' contains the character m.
| Code: |
| SELECT * FROM table WHERE variable LIKE '%m%' |
in php use strstr()
strstr does not have support for wildcards. use preg_match instead. http://php.net/preg_match
| Quote: |
| if a variable contains a certain word or number? |
that can be done with strstr(), if you really need wildcards then yeah you'll have to use preg_match and there (.*) will act like a wildcard.
Ok, thanks for replying.
