pageview holders from different tables

6 posts by 2 authors in: Forums > CMS Builder
Last Post: March 12, 2008   (RSS)

By mawebplus - March 7, 2008

Hi i am posting this to see if you can help me on this issue, i have succesfully made a page viewer that works with one table, i want to have one that brings records from two tables so, it goes like this:

table 1 cms_vehicles : on this one there is a field named owner wich i get from the other table

table 2 cms_owners : on this one i have the owners info

i need a page viewer thatgives me the info from first table andextracts the info from the second table too, depending on the owner field.

thnx for any pointers i am stock here. i am not a php programmer and i am doing my best

Re: [mawebplus] pageview holders from different tables

By Dave - March 7, 2008

No problem. You can just use two viewers and the owner num from the first table to look it up. The second viewer would be a "page viewer" and should look something like this:

<?php
require_once "YOUR_PATH/lib/viewer_functions.php";
$options = array();
$options['tableName'] = 'owners';
$options['recordNum'] = $record['owner'];
$options['where'] = '';
$owner = getRecord($options);
?>


Note that I renamed "$record" in this second viewer to $owner so it won't conflict with the first viewer. You could display the owner fields like this: <?php echo $owner['name']; ?>

Give that a try and let me know how it goes.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] pageview holders from different tables

By mawebplus - March 7, 2008

i did not work as i expectedfor some reason :(

Re: [mawebplus] pageview holders from different tables

By Dave - March 10, 2008

What error did you get? Or what happened?

If you want to attach your page with the viewer code in it I can take a look if you like.

Let me know.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] pageview holders from different tables

By mawebplus - March 12, 2008

did try as you told me but it did not work, and just because i am on a race against time i changed the approach to one full table. thanks for the help ill get some more questions later. [cool]