What I need is to get all the assigned values in a SQL queries. I am only interested in strings and numbers. For example:
SELECT * FROM my_table WHERE ((name="alex" AND age >= 24) OR gender =1)
AND date = CURDATE() ORDER BY active = 1 LIMIT 1
By using PHP's preg_match
I would like to get an array containing the following values:
$values = array(
'alex'// name ,
24 //age,
1 //gender,
1 //active
);
I am a beginner with regular expressions and all I have is this:
preg_match_all('/\=\s*?(.*)\s*/', $sqlquery, $matches);
which will return a single match, the one after the first operator found