CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 PHP-MySQL Like Condition

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.