php - LIKE with dynamic strings -
i'm working on twitter-like mention function, can see, if got mentioned somewhere. can mention writing '@james hi, what's up' - used
$yourusername = $_session['username']; $result = $db->query("select * posts content '%@".$yourusername."' order id"); this code searching entries containing '@yourusername'. problem here is, shows me mentions of @yourusername2 , @yourusername3 - i've tried adding spaces, know, people '@james, ol' bastard :)' or '@james!!!!!'
edit: not real code, know how prevent sql-injections , stuff , i'm using it. keeping code simple.
Comments
Post a Comment