UnknownPlayer Posted November 9, 2010 Share Posted November 9, 2010 How can i use $query = "SELECT * FROM klanovi WHERE naziv = '{$trazi}' OR tag = '{$trazi}'"; but i need to search from base where that $trazi is contained in naziv or tag, i mean like wildacards? And how can i search that text but no matter of lowercase or uppercase ? Link to comment https://forums.phpfreaks.com/topic/218249-selecting-from-mysql-where-text-some_text-help-pls/ Share on other sites More sharing options...
requinix Posted November 10, 2010 Share Posted November 10, 2010 Use LIKE. It'll probably be case-insensitive for you. "...WHERE naziv LIKE '%{$trazi}%' OR tag LIKE '%{$trazi}%'" Link to comment https://forums.phpfreaks.com/topic/218249-selecting-from-mysql-where-text-some_text-help-pls/#findComment-1132475 Share on other sites More sharing options...
wigpip Posted November 10, 2010 Share Posted November 10, 2010 $trazi = strtolower($trazi); $trazi = preg_replace('/\s+/', '|', $trazi); then lower(naziv) REGEXP '$trazi' these are a few pointers as to the functions you will need to use, REGEXP is more forgiving and the preg_replace with OR lets it seach within www.wigpip.com.au Link to comment https://forums.phpfreaks.com/topic/218249-selecting-from-mysql-where-text-some_text-help-pls/#findComment-1132476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.