Looking for suggestions on if this bit of code can be improved..
The goal.  To extract the conditions in the WHERE of an sql statement.
I would appreciate any pointers you may have...
Thanks

----
<?php

$hello = 'Hello';
$world = 'World';
$foo_bar = 'foo bar';

$sql = "SELECT FROM TABLE WHERE id = 1, greeting = '$hello', destination = 
'$world', what = '$foo_bar' ORDER BY some_id";

header('content-type: text/plain');

$regex = '/([a-z0-9_]+)\s?=\s?(\d+|\'.*?\')/';

preg_match_all($regex, $sql, $match, PREG_SET_ORDER);
var_dump($sql, $regex, $match);

?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to