Changing database table name

3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 24, 2012   (RSS)

Hello,

I have a Listing Detail page that displays the advertiser contact details. These contact details are currently being pulled from a table called "homepages".

I would like to change this so that the data comes from the "accounts" table.

I have setup all the fields in the "accounts" table and tried doing a search and replace in the Listing Detail file (searching for "homepages" and replacing with "accounts").

Unfortunately, this doesn't seem to have worked but I don't understand why it hasn't.

I have the following at the top of listingDetail:

// load listings
list($listingsRecordRecords, $listingsRecordDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'homepages',
'where' => "num = '".intval(@$_REQUEST['productNum'])."'",
'limit' => '1',
'allowSearch' => false,
));



So I have changed this to:


// load listings
list($listingsRecordRecords, $listingsRecordDetails) = getRecords(array(
'tableName' => 'listings',
'joinTable' => 'accounts',
'where' => "num = '".intval(@$_REQUEST['productNum'])."'",
'limit' => '1',
'allowSearch' => false,
));



Then each of my fields have been updated from:


<?php echo $listingsRecord['homepages.contact_name'] ?>

to:

<?php echo $listingsRecord['accounts.contact_name'] ?>


Can someone please advise what else I need to do?

Thank you for your help.

Regards,
Greg

Re: [Jason] Changing database table name

Hi Jason,

That's exactly what I needed to know!

Thank you very much.

Regards,
Greg