Need code for seperating data from database
Moderator: General Moderators
-
smartsambath
- Forum Newbie
- Posts: 1
- Joined: Wed Jan 13, 2010 8:12 am
Need code for seperating data from database
hi
Last edited by smartsambath on Mon Sep 26, 2011 3:39 am, edited 1 time in total.
Re: Need code for seperating data from database
is this how the code is within your database?smartsambath wrote:hi...
i need a php code that extract the following data
#*1582*TN_reg*12.30*3232*name*id*454*3545*#
Last edited by aravona on Wed Jan 13, 2010 8:31 am, edited 1 time in total.
-
Marinusjvv
- Forum Commoner
- Posts: 29
- Joined: Wed Dec 02, 2009 5:59 am
Re: Need code for seperating data from database
Code: Select all
$string = "1582*TN_reg*12.30*3232*name*id*454*3545";
$stuff = explode("*",$string);Code: Select all
echo $stuff[0]; // = "1582"
echo $stuff[1]; // = "TN_reg"Re: Need code for seperating data from database
If this how it looks:
Then Marinusjvv explode will obviously show the hash marks. In the array the first and last items will need to be ignored. You will also have to disregard if the * exists at the start and end.
Code: Select all
#*1582*TN_reg*12.30*3232*name*id*454*3545*#-
Marinusjvv
- Forum Commoner
- Posts: 29
- Joined: Wed Dec 02, 2009 5:59 am
Re: Need code for seperating data from database
Well then he can use
I guessed that he had some programming knowledge..
Code: Select all
$string = str_replace('#','',$string); // to remove hashes
$string = substr($string, 1, strlen($string)); // to remove first *