JonnySnip3r Posted June 30, 2010 Share Posted June 30, 2010 Hey guys n gals hope someone can help me with this, anyways i managed (through the help of phpmyadmin) to construct a working search query here it is. SELECT * FROM users WHERE username LIKE '%$search_user%' ok the thing is how would i get it to search more than one table? i have tried several ways and cant seem to get it to work i would like it not just to search username but firstname and lastname aswell. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/206299-php-mysql-search-string-help-please-d/ Share on other sites More sharing options...
premiso Posted June 30, 2010 Share Posted June 30, 2010 You mean more than one column: SELECT * FROM users WHERE (username LIKE '%$search_user%' OR firstname LIKE '%$search_user%' OR lastname LIKE '%$search_user%') Should be what you are after. Quote Link to comment https://forums.phpfreaks.com/topic/206299-php-mysql-search-string-help-please-d/#findComment-1079298 Share on other sites More sharing options...
JonnySnip3r Posted June 30, 2010 Author Share Posted June 30, 2010 Yeah column haha thank you very much dude helped allot i tried something similar but i forgot the brackets haha thank you again!! Quote Link to comment https://forums.phpfreaks.com/topic/206299-php-mysql-search-string-help-please-d/#findComment-1079312 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.