I forgot to mention that the . $row["title"] in the code below displays the "Alt text for each product" that was easy cause it was a row in the table.
Back to the message....
I need someone to help me out with the pinnacle cart regarding the (Smarty Template System)...
All I want to do is add this php code into one of the html files:
Code:
// PHP script
<?
// Connect to the database
mysql_connect ('localhost', 'username', 'pass') ;
mysql_select_db ('dbase');
// Edit this number to however many links you want displaying
$num_displayed = 1 ;
// Select random rows from the database
$result = mysql_query ("SELECT * FROM products ORDER BY RAND() LIMIT $num_displayed");
// For all the rows that you selected
while ($row = mysql_fetch_array($result))
{
// Display them to the screen...
echo "<a href=\"" . $row["link"] . "\">
<img src=\"" . $row["image_url"] . "\" border=1 alt=\"" . $row["title"] . "\">
</a>" ;
}
?>
I just can't figure out 2 stinking things for the life of me! If you look at the // Display them to the screen Section, (right above), I am trying to get the product attributes such as the link that goes with that particular image associated with .$row["image_url"] to display...Please note that the .$row["link"] is incorrect only because the database doesn't contain a row called "link"...My problem is figuring out what goes there...From my shopping cart templates I have something in the lines of:
Code:
<a href="{$index_url}">Go to home page</a>
I just can't figure out the way to make it change according to the .$row["image_url"] which is the random image being displayed.
If you know this "Smarty" "CRAPOLA" leave a tip or two, or three...Or whatever.
Thanks alot!
-Brian
__________________
Brian
TMS BBS: 201-471-2205
Open Friday thru Sunday Eastern Time (US & Canada)
Last edited by Brian07002 : 05-20-2005 at 06:38 PM.
|