How to pick a complex string from MySQL
We can pick a string from MySQL database with various style.
Example, the value from database is NCABZ-2007
And we want only view ABZ
Here is the CODE.
PHP CODE:$data = "NCABZ-2007";
$new_data = substr($data, 2 , 3);
Explain:
2 = number of data from the left (N=0, C=1, A=2, B=3, etc.)
3 = how much char we want to display
No comments:
Post a Comment