Jump to content

Archived

This topic is now archived and is closed to further replies.

theoretical_dreamer

noob here pls help

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.