datadoit.com
|
| Posted: 12/30/2004, 4:51 PM |
|
I'm attempting to test the following:
if (CCGetParam("ret_link") LIKE "%tdc_j6009%") {
do something
}
I can't tell whether the 'LIKE' portion of this statement isn't working, or
the wildcard '%' portion isn't working.
I know this works:
if (CCGetParam("ret_link") == "applications_tdc_j6009.php") {
do something
}
Where am I wrong? Thanks.
-MikeR
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 12/30/2004, 5:01 PM |
|
I believe that PHP doesn't have "LIKE" function or operator ( http://us3.php.net/manual-lookup.php?pattern=like , http://us2.php.net/manual/en/language.operators.comparison.php) and MySQL SQL functions of course cannot be used in PHP.
I am not very good at PHP and not sure of the most efficient method (maybe using regular expressions) but this simple function seems good enough: substr ( http://us2.php.net/manual/en/function.substr.php)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
peterr
Posts: 5971
|
| Posted: 12/30/2004, 5:07 PM |
|
Oops, I was thinking about strpos ( http://us2.php.net/manual/en/function.strpos.php) which searches a string/text for another string/text.
strstr should also work: http://us2.php.net/manual/en/function.strstr.php
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
|