I have a column profile in MySql
firstset=one;two;three|secondset=blue;yellow;red;|thirdset=width;height;|
(expample) I need to get: yellow from secondset to variable
What i wrote:
... MySql query etc ...
...
if ($r_select['profile'] != null)
{
$resultSelect = $r_select['profile'];
$resultArray = explode('|', $resultSelect);
So now i have:
resultArray (
[1] firstset=one;two;three
[2] secondset=blue;yellow;red;
[3] thirdset=width;height;
)
I need to find where in resultArray[] is secondset= then save this in variable- i want to get
$found = "secondset=blue;yellow;red;"
I know how to explode variable but i cant find string in array[]
in_array()do what you want to find a string in an array?$resultArray. Split the element first on=, then split the second part of that on;. Then usein_array()to search that array for"yellow".yellowwill be infirstsettoo ? So what will be better? create new table or playing around with it?