Gossamer Forum
Home : General : Databases and SQL :

Re: [sooke] Update records in a table based on a function

Quote Reply
Re: [sooke] Update records in a table based on a function In reply to
Try:
Code:
my $has_children = (has_children($category_id)) ? 'Yes' : 'No';
$DB->table('Category')->update({ haschildren => $has_children}, { ID => $category_id }

BTW: if you are going to do many selects, updates etc, with the same category, you can save yourself some writing if you define the table object $cat = $DB->table('Category'). Then you can just write $cat in place of $DB->table('Category')

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Subject Author Views Date
Thread Update records in a table based on a function Ian 14971 May 15, 2002, 10:46 PM
Thread Re: [sooke] Update records in a table based on a function
yogi 14876 May 16, 2002, 12:27 AM
Post Re: [yogi] Update records in a table based on a function
Paul 14653 May 16, 2002, 12:52 AM
Post Re: [yogi] Update records in a table based on a function
Ian 14698 May 16, 2002, 8:30 AM
Post Re: [yogi] Update records in a table based on a function
Ian 14683 May 16, 2002, 9:05 AM
Thread Re: [yogi] Update records in a table based on a function
Ian 14720 May 16, 2002, 10:22 AM
Thread Re: [sooke] Update records in a table based on a function
Paul 14741 May 16, 2002, 10:45 AM
Post Re: [Paul] Update records in a table based on a function
Ian 14683 May 16, 2002, 10:56 AM
Thread Re: [yogi] Update records in a table based on a function
Ian 14721 May 19, 2002, 4:37 PM
Thread Re: [sooke] Update records in a table based on a function
yogi 14691 May 20, 2002, 6:05 AM
Thread Re: [yogi] Update records in a table based on a function
Ian 14695 May 20, 2002, 8:33 AM
Thread Re: [sooke] Update records in a table based on a function
webmaster33 14719 May 20, 2002, 9:44 AM
Post Re: [webmaster33] Update records in a table based on a function
Ian 14579 May 20, 2002, 9:48 AM
Post Re: [sooke] Update records in a table based on a function
webmaster33 14622 May 20, 2002, 6:18 AM