quickstopman Posted December 1, 2007 Share Posted December 1, 2007 hey guys im currently working on a blog system with tags i get how it all works but what i don't get is how you scan a mysql_query string to see if it contains something so for the search page i want it to show all the blog entries that have "bobber" in the tags here is the code: <?php include("header.html"); if(isset($_GET['tag'])) { $sql = mysql_query("SELECT * FROM blogs WHERE tags = '{$_GET['tag']}'") or die(mysql_error()); while ($r = mysql_fetch_array($sql)) { echo $r['title'] ."<br>"; } } include("footer.html"); ?>> any one know?? thanks Quote Link to comment Share on other sites More sharing options...
toplay Posted December 1, 2007 Share Posted December 1, 2007 I don't really understand you since you have the code there already to search for an exact comparison. If you're talking about looking for not an exact match, then you can use "LIKE" or REGEXP: http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_like http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html#operator_regexp Quote Link to comment Share on other sites More sharing options...
quickstopman Posted December 1, 2007 Author Share Posted December 1, 2007 ok i got it too work with eregi and some IF statements!! thanks guys 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.