Walker33 Posted April 21, 2011 Share Posted April 21, 2011 I think I know the answer to this, but it would make things easier if I could do what I think I can't. Can I use LIKE and NOT LIKE in an if statement? Doesn't seem to be working for me. <?php //$rightlic is a twelve character string ending either P00, P01, V00, or V01. I want to do different things based on V or P if ($rightlic not like '%V00' AND $rightlic not like '%V01'){ echo "<br>purchaser ran demo as public but is now trying to purchase a private account. Stop the process."; exit; } ?> Can I do something like this or do I have to separate the string and look for the last characters that way? Thanks in advance for any help. Quote Link to comment Share on other sites More sharing options...
mens Posted April 21, 2011 Share Posted April 21, 2011 No it wouldn't, PHP doesn't support SQL statements. Look at strstr() or preg_match(). Quote Link to comment Share on other sites More sharing options...
Walker33 Posted April 21, 2011 Author Share Posted April 21, 2011 Okay, thanks. I didn't think so, but I wanted to be sure, and I couldn't find a definitive answer anywhere. Appreciate it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.