Regex to get sql statement parts
- From: "josh.23.french" <josh.23.french@xxxxxxxxx>
- Date: 21 Oct 2006 14:54:43 -0700
Does anyone have a regex (or knows how to make one) that will get the
parts of an sql statement?
$sql = "SELECT (* or 'id, username, etc') FROM `(tablename)`, [WHERE
`id` = 1 and `username` = ".$username."][LIMIT (#)]"
it should return the following array:
$returnd_val = array(
'fields'=>''(* or 'id, username, etc')",
'table'=>"(tablename)",
'where'=>"(`id` = 1 and `username` = \"joe user\")",
'limit'=>"1"
);
A similar regex for update, delete, and insert would help too ;)
.
- Follow-Ups:
- Re: Regex to get sql statement parts
- From: petersprc
- Re: Regex to get sql statement parts
- Prev by Date: Re: Can't find built-in PHP function which I know exists...
- Next by Date: Re: MySQL 4.1 / PHP 5.0 : Unicode problems
- Previous by thread: Can't find built-in PHP function which I know exists...
- Next by thread: Re: Regex to get sql statement parts
- Index(es):