_OwNeD.YoU_ Posted December 3, 2008 Share Posted December 3, 2008 Hi guys again, trying query only for the letter k, but its not the first letter cant figure these wildcards out. UCUS-98646 Killzone Liberation [uS] the k for killzone Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/ Share on other sites More sharing options...
revraz Posted December 3, 2008 Share Posted December 3, 2008 Use the LIKE parameter LIKE '%k%' LIKE 'k%' LIKE '%k' Your choice on how you want to do it. Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705263 Share on other sites More sharing options...
_OwNeD.YoU_ Posted December 3, 2008 Author Share Posted December 3, 2008 yea but UCUS-98646 Killzone Liberation [uS] if there was any K in the title i wouldnt work right, it would grab any with k's Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705267 Share on other sites More sharing options...
revraz Posted December 3, 2008 Share Posted December 3, 2008 Huh? If you are looking to only grab what is after UCUS-98646 as the start of your search, then you need to use RegEx. I assume your title is the entire line you posted? Is the format always the same? Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705275 Share on other sites More sharing options...
premiso Posted December 3, 2008 Share Posted December 3, 2008 What exactly are you trying to do? If this is in a database, why not put UCUS-98646 Killzone Liberation [uS] into 3 seperate fields? IE: UCUS-98646 in a field called "code" Killzone Liberation in a field called "title" US in a field called "country" That will save you tremendous heartache of parsing etc and will allow for easy searchability etc. And you can easily rebuild the string to look like it does above. Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705292 Share on other sites More sharing options...
_OwNeD.YoU_ Posted December 3, 2008 Author Share Posted December 3, 2008 $text = $data[title]; if(preg_match('/^([^\s]+)\s+(.+)\s+\[(..)\]$/',$text,$matches)){ list(,$code,$title,$country) = $matches; did that but how would i just show all $title begining with the letter k Huh? If you are looking to only grab what is after UCUS-98646 as the start of your search, then you need to use RegEx. I assume your title is the entire line you posted? Is the format always the same? format is the entire line, format is also always the same Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705298 Share on other sites More sharing options...
_OwNeD.YoU_ Posted December 3, 2008 Author Share Posted December 3, 2008 If you are looking to only grab what is after UCUS-98646 as the start of your search, then you need to use RegEx. I assume your title is the entire line you posted? yes and im looking to arrange with the first letter after the UCUS-98646 Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705372 Share on other sites More sharing options...
sasa Posted December 4, 2008 Share Posted December 4, 2008 try SELECT * FROM `proba` WHERE SUBSTRING( name, LOCATE( ' ', name ) +1 ) LIKE 'K%' Quote Link to comment https://forums.phpfreaks.com/topic/135405-arranging-by-letter/#findComment-705564 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.