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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -