开发者

how to split a data from database based on character

I have a data april/2010 to jan/2011 Is th开发者_如何学Goere any way to split the data with character to and select the date as The value before "to" as FROM and The Value after "to" as TO how to selet the splited value......... while i am selecting the data as it is as select date from mytbl how to select the date as two values


If you have your data in a string, like this :

$str = 'april/2010 to jan/2011';

You can use the explode function to get the two parts :

list ($from, $to) = explode(' to ', $str);


Then, just to be sure, if we echo them :

echo "From : $from<br />";
echo "To : $to<br />";

We get :

From : april/2010
To : jan/2011
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜