Guest Posted September 24, 2007 Share Posted September 24, 2007 I want to make a query that selects any one character example I want to select 123 but not 1234 I have tried this 12% but this brings up both I just want 12any single character How can I do this? Quote Link to comment https://forums.phpfreaks.com/topic/70453-solved-mysql-any-single-character/ Share on other sites More sharing options...
rarebit Posted September 24, 2007 Share Posted September 24, 2007 Not quite sure what you want but try str_split(), http://uk3.php.net/manual/en/function.str-split.php $s = "1234"; $a = str_split($s); echo $a[0]; or $s = "1234"; $a = str_split($s, 3); echo $a[0]; Quote Link to comment https://forums.phpfreaks.com/topic/70453-solved-mysql-any-single-character/#findComment-353956 Share on other sites More sharing options...
HuggieBear Posted September 24, 2007 Share Posted September 24, 2007 Use an underscore (_) it's the SQL wild card for single character. SELECT column FROM table WHERE column LIKE '12_' Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/70453-solved-mysql-any-single-character/#findComment-353958 Share on other sites More sharing options...
Guest Posted September 25, 2007 Share Posted September 25, 2007 Thank you the underscore did it exactly thank you Quote Link to comment https://forums.phpfreaks.com/topic/70453-solved-mysql-any-single-character/#findComment-354597 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.