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

2009-08-21 Thread דניאל דנון
Update: I've changed it into "/^(\*|[a-z_, \(\)0-9]+)[\s]+FROM[\s]+([a-z_\.]+)(\s+)?(WHERE[\s]+(.+))?\s*(LIMIT\s+([0-9]+)\s*,\s*([0-9]+))?\s*(ORDER BY ([a-z0-9, ]+)?(\s*(DESC|ASC)))?$/Ui" Only problem that on: SELECT * FROM table WHERE field2='field3' ORDER BY id DESC LIMIT 0,10 it outputs Arra

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

2009-08-21 Thread דניאל דנון
You all misunderstood my question, please read my replies above... I'm looking to extract it from a string - *I'm not executing the queries, I only get them as a string* And to the topic: Since everything I found was very complicated to parse, I've crafted my own preg pattern, "/^(\*|[a-z_, \(\

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

2009-08-21 Thread Daevid Vincent
> -Original Message- > From: Nisse Engström [mailto:news.nospam.0ixbt...@luden.se] > > If you're using MySQL, you can try mysql_field_name() > and see if it gets you anywhere. I don't think it works > on empty results though. FYI. It will. -- PHP General Mailing List (http://www.php.ne