user1083320
user1083320

Reputation: 1946

Zend SQL Select ALL columns except one

My "Users" table has many many fields, including the password field. So, if I want to select a user and get ALL the information, how can I do this in Zend but excluding the password field? I know I can manually type in all the fields, but I was wondering if there is a way to exclude one field?

Thanks Kousha

Upvotes: 0

Views: 1039

Answers (1)

Tim Lytle
Tim Lytle

Reputation: 17624

I'm not sure that this is an efficient way to do this (I believe the meta data can be cached), but you could use Zend_Db_Table to get the columns, then just remove the password column.

Would look something like this:

$info = $table->info();
$columns = $info['cols'];
unset($columns[array_search('password', $columns)]);
//you can now pass $columns to a Zend_Db_Select

Upvotes: 1

Related Questions