dimanche 5 avril 2015

How to Extract substrings between two special characters in php or MySQL?

I have a varchar field in a MySQL table.


The field stores different strings i.e. for example


string1


string2


string3


But it stores them in this format:


+string1+string2+string3+


i.e. every string is bound by character '+'.


Now I have PHP page coded for accessing this table.


All I require is extracting these string1,string2,string3 in php variables.


I have accessed the database and saved the string "+string1+string2+string3+" in one php variable.


Now, Is there any inbuilt function in php (or mysql for that matter), which can give me separated string1, string2, string3 to save in three different php variables?


Also three strings is just for an example. Various tuples might save different numbers of strings.


Any help is appreciated.


Thank You :D


Aucun commentaire:

Enregistrer un commentaire