Multi-Record

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 23, 2009   (RSS)

Re: [jasonbro] Multi-Record

By Dave - February 21, 2009

Try adding this option below 'limit':

'offset' => '1',

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-Record

Hi,

That worked fine.

However, the problem I will run into is if I have 50 records and I set the code on record 48 to [font "Verdana"]'offset' => '48', that will be fine, unless I delete a record before it. So if I delete record 5, record 48 would now become record 47 and the wrong page would appear or if i had 'offset' => '50' and deleted a record leaving 49 records, 'offset' => '50' would not exist.

How can I overcome this? Is there a way to add a record name instead of a number so it would not matter if a previous record was deleted?

Re: [jasonbro] Multi-Record

By Dave - February 23, 2009

Hi jasonbro,

Yes, you can lookup a record by name or number:

list($couponsRecords, $couponsMetaData) = getRecords(array(
'tableName' => 'coupons',
'where' => " num = 3 ",
'limit' => '1',
));
$couponsRecord = @$couponsRecords[0]; // get first record


... or ...

list($couponsRecords, $couponsMetaData) = getRecords(array(
'tableName' => 'coupons',
'where' => " name = 'my coupon name' ",
'limit' => '1',
));
$couponsRecord = @$couponsRecords[0]; // get first record


Hope that helps. If that's not it, let me know some more details about what you're trying to do.
Dave Edis - Senior Developer
interactivetools.com