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

From: Date: Fri, 21 Aug 2009 13:27:38 +0000
Subject: Re: Extract column names from a (my)SQL query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-297058@lists.php.net to get a copy of this message
On Wed, 19 Aug 2009 22:42:36 +0300, דניאל דנון wrote: > 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. 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. /Nisse

« previous php.general (#297058) next »