Multi-select to display links and images

21 posts by 4 authors in: Forums > CMS Builder
Last Post: June 1, 2009   (RSS)

By Dave - July 30, 2008

It looks like you're getting the upgrade labels in the MySQL query and not the upgrade numbers like you want. Note that is you previously saved the values by name and then changed it the old values will still be stored until you resave that record.

Anytime a MySQL query isn't working the first thing to do is back up and print out the variables you're passing to it (or the query itself). Try this debug code:

print "<xmp>Product Record: ";
print_r($productsRecord);
print "</xmp>";

or

print "<xmp>a_upgrades: ";
print_r($productsRecord)['a_upgrades'];
print "</xmp>";

Another trick is to add this option which displays the SQL being executed:

'debugSql' => true,

Let me know if that reveals anything useful.

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

By Dave - July 30, 2008

I think we still need to get the product numbers in the "numIN (...)" part. Not sure why it's using labels and not nums.

For the "undefined index' error, is the field called 'upgrades' or 'a_upgrades'? Undefined index means it couldn't find that field in the record. You can try displaying all the fields in the record with this code to see what fields are available (or where the missing ones are):

<xmp><?php print_r($record); ?></xmp>

If it keeps giving errors feel free to email me FTP and CMS login details and I could take a look.

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

Re: [Dave] Multi-select to display links and images

By Kenny - July 30, 2008

That worked! No more errors!

Now one other little problem with the display: it groups them together into two different groups as a paragraph. How do I make them show up as a list in 1 column (leaving out blank spots for items that are unchecked)

I have:

<tr>
<td><?php foreach ($relatedProductRecords as $record): ?><font face="Arial" size="2"><?php echo $record['a_upgrades'] ?><br></font><?php endforeach ?></td>
</tr>



The sample output can be seen here:

http://www.lelandsindustries.com/products/product2.php?Metal-Buildings-3

By Dave - July 30, 2008

The multiple values are stored in a tab delimited list. So you could try this to get it into an array (list):

// note: replace table and variable names with the right ones for your site:
$labels = getListLabels('products', 'related_products', $productsRecord['related_products']);

Then
<?php echo join('<br/>', $labels); ?>

or
<?php foreach ($labels as $label): ?>
<?php echo $label ?><br/>
<?php endforeach ?>

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

Re: [Dave] Multi-select to display links and images

By willbegood - June 1, 2009

Dave i have the last version of CMS Builder, and it doesn't work as you explain it.
Do you think it's coming from CMS Builder version? I do exactly what is saying in the posts.

Re: [willbegood] Multi-select to display links and images

By Dave - June 1, 2009

Hi willbegood,

Can you attach the viewer page you are working on and post the error message (if any) you are getting? Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-select to display links and images

By willbegood - June 1, 2009

Thanks, here is the file

here is the list : http://www.onsemobilisepourvous.com/client/caribbean_spirit_net/gmap3/test8.php

Clicking on one of the link go to the "detail.php" attached
Neither in test8.php (list) nor detail.php (detail page) i can make it work

In test8.php i can see only one linked data per entry
And in detail.php nothing.
Attachments:

detail.php 4K

Re: [willbegood] Multi-select to display links and images

By Dave - June 1, 2009

Hi willbegood,

Is this the same issue as this post?
http://www.interactivetools.com/forum/gforum.cgi?post=72137#72137

If so, let's continue the discussion over there. If it's a different issue just let me know.

Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Multi-select to display links and images

By willbegood - June 1, 2009

yes it's the same issue.