theoretical_dreamer Posted May 30, 2006 Share Posted May 30, 2006 I had a search form but I have to separate the values that was inputted by the user. For example the user inputs m12ws001. How can I separate this query into 4 separate field in the database? Example: mw12ws001 -----> m=branch,12=floor, ws=machine, 001-host number Quote Link to comment https://forums.phpfreaks.com/topic/10749-noob-here-pls-help/ Share on other sites More sharing options...
poirot Posted May 30, 2006 Share Posted May 30, 2006 Assuming they will have always the same number of characters and the same structure, you can use substr()[a href=\"http://www.php.net\" target=\"_blank\"]http://www.php.net[/a][code]$branch = substr($str, 0, 1);$floor = substr($str, 1, 1);// et cetera...[/code] Quote Link to comment https://forums.phpfreaks.com/topic/10749-noob-here-pls-help/#findComment-40166 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.