how can i use like operator in conditional statements in PHP
Apr 20th, 2003 01:15
Rachit Bagda, Shashank Tripathi, Rama,
ANSWERED by SHASHANK TRIPATHI:
Not sure what you mean, but LIKE is usually a part of SQL. Which means
it is available to you only within databases. To compare strings within
PHP or other programming languages, you need to use string matching
functions. E.g., in PHP, conceptually:
If you had this in your SQL --
WHERE NAME LIKE '%keyword%'
This can be written in PHP as --
if (strpos($NAME, "keyword"))
// Found, do what is needed..
Does this help?