Onlt getting first record

5 posts by 3 authors in: Forums > CMS Builder
Last Post: September 30, 2011   (RSS)

Hi Guys,

I think the following code is forcing the "detail page" to show only the first record, not the actual record...

list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'limit' => '1',
));
$listingsRecord = @$listingsRecords[0];
if (!$listingsRecord) { header("HTTP/1.0 404 Not Found"); print "Listing not found!"; exit; }

list($agentsRecords, $agentsMetaData) = getRecords(array(
'tableName' => 'agents',
'where' => mysql_escapef('num = ?', $listingsRecord['agent']),
'allowSearch' => false,
'limit' => 1,
));
$agentsRecord = @$agentsRecords[0];
if (!$agentsRecord) { header("HTTP/1.0 404 Not Found"); print "Agent not found!"; exit; }


This can be seen at
http://www.sydneyresidential.com.au/buying.php

Due to the hosting provider being absolute [insert profanity here] the site is live... I've attache dthe list and details page if it helps...
Cheers,

Tim (toledoh.com.au)
Attachments:

detail_008.php 8K

buying.php 6K

Re: [Toledoh] Onlt getting first record

By Jason - September 30, 2011

Hi Tim,

The problem here is with your first query. Since you are not setting a WHERE clause, getRecords() is just returning the first record from the database. Try this change:

list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'where' => whereRecordNumInUrl(),
'limit' => '1',
));
$listingsRecord = @$listingsRecords[0];
if (!$listingsRecord) { header("HTTP/1.0 404 Not Found"); print "Listing not found!"; exit; }


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Toledoh] Onlt getting first record

By ross - September 30, 2011

Hi Tim

Great! Wanted to make sure that means you are back in business. Let me know if there is something I can still go over with you on this one.

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Onlt getting first record

All good - thanks Ross
Cheers,

Tim (toledoh.com.au)