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 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] Link to comment https://forums.phpfreaks.com/topic/10749-noob-here-pls-help/#findComment-40166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.