I have a database table in which one column contain the string value that is looks like dictionary in php.
Table:College
Id name requirement
1 x {"users": ["A", "B"], "name": "*", "pool": "CSE", "place": "Bangalore"}
2 y {"users": ["A", "C"], "name": "*", "pool": "CSE", "place": "Chennai"}
3 z {"users": ["A", "B"], "name": "*", "pool": "ECE", "place": "Bangalore"}
4 r {"users": ["A", "D"], "name": "*", "pool": "EEE", "place": "UP"}
From this table I need to filter only those rows in which the requirements column contain “pool”:”CSE”. That is if pool is CSE or pool is ECE etc .
Currently my php code for fetching whole table is:
$query = "SELECT * FROM waitqueue";
$result = mysql_query($query);
echo "[";
echo json_encode(mysql_fetch_assoc($result));
while ($row = mysql_fetch_assoc($result))
echo "," . json_encode($row);
echo "]";
I dont want to change the above sql query.Because I need both conditions(full table and selected pool rows) from single query.So I wish to parse from results.
How to match the "pool" and how can I filter those rows?
Any one please suggest me.
Thanks in advance.