LanceT Posted January 13, 2007 Share Posted January 13, 2007 I'm using the following code[code] $result = mysql_query("SELECT * FROM `table` WHERE type='$type' ORDER BY `name` ASC LIMIT 0,5", $dbh);[/code]I have a row of types in my Mysql database, but is there a way I can make it so that type doesn't have to exactly equal the type in my database, but it only requires that the $type be present somewhere inside the string?To be more clear, if $type was "hello", then it would select types of "hello" but also "hello, world" Quote Link to comment Share on other sites More sharing options...
trq Posted January 13, 2007 Share Posted January 13, 2007 [code=php:0]$result = mysql_query("SELECT * FROM `table` WHERE type LIKE '%$type%' ORDER BY `name` ASC LIMIT 0,5", $dbh);[/code] 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.