wilson210484 Posted September 23, 2008 Share Posted September 23, 2008 Hi everyone i such a newb!!! What i want to do is in the product_info.php page of my site i want an if statement, if the model number contains '(g)' then say well anything. i have no idea how to do this and i tried looking at how an sql search works but really i have no idea. here is my code <?php if ($the_product_info['products_model'] LIKE CONVERT('%(g)') { echo 'It works!!!'); ?> any help would be great thanks Link to comment https://forums.phpfreaks.com/topic/125452-solved-whats-the-code-for-contains/ Share on other sites More sharing options...
kpasiva Posted September 23, 2008 Share Posted September 23, 2008 Hi, You have to use string handling functions to achieve this, <?php if (strpos($the_product_info['products_model'],'g') !== false) { echo 'It works!!!'; } ?> Link to comment https://forums.phpfreaks.com/topic/125452-solved-whats-the-code-for-contains/#findComment-648559 Share on other sites More sharing options...
wilson210484 Posted September 23, 2008 Author Share Posted September 23, 2008 Thanks i would have been stuck on this for weeks :) :) :) Link to comment https://forums.phpfreaks.com/topic/125452-solved-whats-the-code-for-contains/#findComment-648564 Share on other sites More sharing options...
kpasiva Posted September 23, 2008 Share Posted September 23, 2008 Welcome Always here to help -Siva Link to comment https://forums.phpfreaks.com/topic/125452-solved-whats-the-code-for-contains/#findComment-648566 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.