News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate's Blog:
Selecting all except some columns in MySQL
March 02, 2009 @ 11:13:08

Sameer Borate shows how to turn things around in your application's SQL statement and, instead of selecting the columns you need, showing how to remove the columns you don't need dynamically.

The MySQL SELECT is a ubiquitous statement. You can select rows using the '*' operator or by listing the individual column names. But many times you may require using all the columns from a table except a couple of them. For example you may have a table containing twelve columns from which you require only eleven columns.

Sometimes that extra column can contain larger content you might not need or want. He creates a get_column_names and create_statement functions that grab the column names and, based on an "exclude" array, takes out the unwanted records. The array is then looped through and appended back together as the new column list for the select.

0 comments voice your opinion now!
select exception mysql column array remove


blog comments powered by Disqus

Similar Posts

php|architect: January 2008 Issue Released

Zend Developer Zone: Zend Framework Hidden Gems: Zend Plumbing

CodeFury.net: CodeIgniter/PHP + IIS + MySQL + MSSQL: It Works!

Wez Furlong\'s Blog: PDO MySQL slides from MySQLUC 2006

Jani Hartikainen's Blog: Did you think your site validated input properly? Think again!


Community Events





Don't see your event here?
Let us know!


library api wordpress podcast laravel symfony application series developer list install language configure community code threedevsandamaybe release introduction bugfix interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework