Detail Page- Code for Second Record

2 posts by 2 authors in: Forums > CMS Builder
Last Post: July 17, 2008   (RSS)

By sidcam - July 17, 2008

New to CMS Builder. Simple question I think. I want to create a Detail Page for a record other than the first record but I can't figure out what to enter into the "Where" clause or how to customize it to work. For this example the table is named "header", and the Second record has a title field named "Test".



<?php

require_once "/home/u7/sidcam/html/cmsAdmin/lib/viewer_functions.php";

list($headerRecords, $headerMetaData) = getRecords(array(
'tableName' => 'header',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$headerRecord = @$headerRecords[0]; // get first record

?>

Re: [sidcam] Detail Page- Code for Second Record

By Dave - July 17, 2008

Hi sidcam,

Do you want to use the same page (yourPage.php) display a different record or do you want to create a second page that displays the other record?

If it's the same page you can just put the record number in the url like this: yourPage.php?123

If it's a different page (otherPage.php) you could hard code it to look up the record by number or field value like this:

'where' => 'num = 123',

or:

'where' => 'title = "Test"',

Hope that helps. If you're still not sure then let me know some more details about the section your trying to create or what you're trying to do and I'll be happy to give you some suggestions.
Dave Edis - Senior Developer
interactivetools.com