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
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!
interactivetools.com
Re: [Dave] Multi-select to display links and images
By Kenny - July 30, 2008
SELECT SQL_CALC_FOUND_ROWS * FROM `cms_products` WHERE (num IN (2x3 Window, 3x4 Insulated Window, 4, 8, Extra Set of Doors, Framing Package - $1.75 per sq. ft., Heavy Duty Floor - $50.00 per 8, On-Site Build - Add 12%, Pressure Treated Floor - $100 per 8, Turbine)) ORDER BY dragSortOrder
I wasn't using dragSortOrder on the "upgrades" section so I put it in - same result.
I was using dragSortOrder on the "products" section so I took it out - no more mySql error!
Now where the features are supposed to be:
Upgrades: Notice: Undefined index: upgrades in /home/lelands/public_html/products/product2.php on line 136
My code there is:
<table border="0" cellpadding="3" cellspacing="3" width="100%" id="table42">
<tr>
<td bgcolor="#ED1C24"><b>
<font face="Arial" color="#FFFFFF">Name: <?php echo $productsRecord['name'] ?></font></b></td>
</tr>
<tr>
<td><font face="Arial" size="2">Description: <?php echo $productsRecord['description'] ?></font></td>
</tr>
<?php foreach ($relatedProductRecords as $record): ?>
<tr>
<td><font face="Arial" size="2"> Upgrades: <?php echo $record['upgrades'] ?><br/>
Price: <?php echo $record['price'] ?><br/></font></td>
</tr>
<?php endforeach ?>
My top of page code is the same as yesterday.
By Dave - July 30, 2008
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!
interactivetools.com
Re: [Dave] Multi-select to display links and images
By Kenny - July 30, 2008
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
// 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!
interactivetools.com
Re: [Dave] Multi-select to display links and images
By willbegood - June 1, 2009
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
Can you attach the viewer page you are working on and post the error message (if any) you are getting? Thanks!
interactivetools.com
Re: [Dave] Multi-select to display links and images
By willbegood - June 1, 2009
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.
Re: [willbegood] Multi-select to display links and images
By Dave - June 1, 2009
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!
interactivetools.com
Re: [Dave] Multi-select to display links and images
By willbegood - June 1, 2009