I need help in solving a query. In Hobbies column of Employee table , different Hobbies of each employee is stored. An example is as shown below "Reading,Sports,Trekking" I need a query to split the string and find the second hobby of an employee. I tried instr to find ",". But was not not able to proceed beyond that. Can anyone suggest a query to split a string and return as array.
$a = strstr('Reading,Sports,Trekking', ',');//get the first [SIZE=14px][FONT=verdana][COLOR=#000000]occurrence of a string ( ,Sports,Trekking)[/COLOR][/FONT][/SIZE] $b = explode(',',trim($a, ','));//delete the ' , ' from both side, split the string by ',' & store the value in variable $b echo $b[0]; PHP: