how do i compare the with if else statement. in mysql query i can use LIKE % statement.
i want to compare the string result with php.
ie: Pro Tan 3mins, Pro Tan 6mins, Pro Tan 9mins
in mysql :
$db->query("SELECT * FROM treat WHERE tanning LIKE 'Pro Tan%'");
in php:
if($tanning == 'Pro Tan') :
echo 'xxx';
else :
echo 'zzz';
endif
// output zzz
There are a variety of different comparison functions you can use, depending on how sophisticated you want to make your comparison. To find specifically a string that starts with “Pro Tan”, you could do:
Note the triple
===, since ifstrposreturnsfalse, that’s not at all the same as returning0.