JOIN question... I think

28 posts by 6 authors in: Forums > CMS Builder
Last Post: July 19, 2011   (RSS)

By willbegood - June 1, 2009

Other thing Dave,

I want to make it work on the detail.php page (in fact it's really what i need.

I've tryed this
list($produitsRecords, $produitsMetaData) = getRecords(array(
'tableName' => 'produits',
'leftJoin' => array(
'point_dinteret' => 'ON produits.linkedPOI LIKE CONCAT("%\t", point_dinteret.num, "\t%")',
),
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$produitsRecord = @$produitsRecords[0]; // get first record


and then

<h1>PRODUITS - Detail Page Viewer</h1>
Record Number: <?php echo $produitsRecord['num'] ?><br/>
Nom du produit: <?php echo $produitsRecord['productname'] ?><br/>
Lattitude: <?php echo $produitsRecord['lattitude'] ?><br/>
Longitude: <?php echo $produitsRecord['longitude'] ?><br/>
Points d'intérêt liés: <?php echo join(', ', getListLabels('produits', 'linkedPOI', $produitsRecord['linkedPOI'])); ?><br/>
_link : <a href="<?php echo $produitsRecord['_link'] ?>"><?php echo $produitsRecord['_link'] ?></a><br/>


<?php foreach ($point_dinteretRecords as $record): ?>
Record Number: <?php echo $record['titre'] ?><br/>
Lattitude: <?php echo $record['lattitude'] ?><br/>
Longitude: <?php echo $record['longitude'] ?><br/>
<?php endforeach; ?>


see : http://www.onsemobilisepourvous.com/client/caribbean_spirit_net/gmap3/test8.php then click on the link to see detail.php i'm talking about.

What i want is

- display all the fields of my "produits" entry
- display all the "linkedPOI"

thanks, if it works, i will show you the all result, what i'm trying to do in detail.php is to place an icon on google map representing my "produits" entry. And display all the "linkedPOI" (linked point of interest) associated with the entry.

And each linkedPOI is defined by a latitude, longitude, title, icon etc.

Please help i'm very very close to make it work.[:)]
Attachments:

detail_001.php 3K

Re: [willbegood] JOIN question... I think

By Dave - June 1, 2009

Maybe something like:

<?php foreach ($produitsRecords as $record) : ?>
<?php if (@$lastNum != $record['num']): ?>
... show product details first time ...
<?php endif ?>
<?php $lastnum = $record['num']; ?>
... show linkedPOI details ...
<?php endforeach ?>


Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

By willbegood - June 1, 2009

no it doesn't work.
same "produits" always repeating with each associated linkedPOI
Attachments:

test8_001.php 3K

Re: [willbegood] JOIN question... I think

By ross - June 3, 2009

Hi there.

Could you post a link to your site so we can see the code in action? Also, could you attach an updated copy of detail.php to your next post? Don't just paste the code into a post if you don't mind. It's much easier to read if you attach the file :).

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] JOIN question... I think

By willbegood - June 3, 2009

code in action : http://www.onsemobilisepourvous.com/client/caribbean_spirit_net/gmap3/test8.php

the click on one of the link
Attachments:

test8_002.php 3K

detail_002.php 3K

Re: [willbegood] JOIN question... I think

By ross - June 5, 2009

Hi there.

I have been looking this over for you and it seems like the detail.php page doesn't actually load at all right now. Were you working on it? Or is that what you wanted to troubleshoot first?

We'll definitely need to make sure detail.php actually loads properly before trying to figure out how to get the proper linkedPOI loading.

Let me know. 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] JOIN question... I think

By willbegood - June 5, 2009 - edited: June 5, 2009

Hello Ross, check the new detail.php (i just user cms builder generator to process it).

Rember i want to see all the fields of each linkedPOI (calling from "point_dinteret" table).

See : http://www.onsemobilisepourvous.com/client/caribbean_spirit_net/gmap3/test8.php

then click on on of the links.

exemple : http://www.onsemobilisepourvous.com/client/caribbean_spirit_net/gmap3/detail.php?Un-appart-a-Gosier-2

I will appreciate fast answer... it(s been several week i'm turning around with several post on the forum and i only have a begging of solution > see test8.php for that,

In test8.php it works but always repeat the entry of "produits" table for each associated linkedPOI (from "point_dinteret" table).

In details page i want to have my "produits" fields and all the fields of associated entry calling via "linkedPOI" from "point_dinteret" table.

Also you can connect to the admin here : [removed by Ross]

Perhaps it can help

PLEASE HELLLLLPPPPP!!!!!!
Attachments:

detail_003.php 3K

test8_003.php 3K

Re: [willbegood] JOIN question... I think

By ross - June 5, 2009

Hi there.

Thanks for posting! One really important thing here is that you don't want to be posting login details to your site on our forum :). Those are always better sent through email. I removed them from your post.

Would you mind emailing me those details along with FTP details through consulting@interactivetools.com

This one is definitely starting to get a little tricky so it might end up being something we turn into a full fledged consulting project.

Send that email for now though and we'll go from there.

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] JOIN question... I think

By mbareara - March 7, 2011 - edited: March 7, 2011

Hi,
maybe here someone could help me.
:)

I have a soccer site and two table:

Team
Match

In match table i have two field 'team_home' and 'team_away' both linked with 'team.num'.

I would have a detail page of 'Match' with the name of team away and team home, but i don't know how join two tables because i have two field linked and not only one as in the previous post.

Sorry for my awful english :-(