Re: [PHP] Extract column names from a (my)SQL query

2009-08-20 Thread דניאל דנון
I haven't finished reading it yet - but this looks great - Thank you so
much!
On Thu, Aug 20, 2009 at 4:36 PM, kranthi  wrote:

> this might be some help...
>
> http://stackoverflow.com/questions/283087/php-mysql-sql-parser-insert-and-update
>



-- 
Use ROT26 for best security


Re: [PHP] Extract column names from a (my)SQL query

2009-08-20 Thread kranthi
this might be some help...
http://stackoverflow.com/questions/283087/php-mysql-sql-parser-insert-and-update

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



[PHP] Extract column names from a (my)SQL query

2009-08-19 Thread דניאל דנון
Lets assume I have the following string:
"SELECT field1, field2, field3 FROM tablename WHERE field1 = 'something' "

Is there any way to get "field1, field2, field3"? assuming it might also
have join, left join - things like that.

I can easily do it with preg_match, but I have to make sure its "foolproof".
It would be a lot better if it will also be able to parse the whole query -
catch limit, where, joins, comments


Is there any php class that could do it?

I've looked in the pear site and on Google but haven't had any luck.

-- 
Use ROT26 for best security