Reply
Smarty Plugin Needed For Pinnacle Cart...
Old 05-04-2005, 05:12 PM Smarty Plugin Needed For Pinnacle Cart...
Brian07002's Avatar
Webmaster Talker

Posts: 527
Name: Brian
Location: United States
Hi All,

I am going to need a plug-in that would perform a database query on the products table in mysql db, and select a random product record. The plug-in would then assign the random record to a Smarty array. If you know about Pinnacle Cart, that's what I use for my shopping cart.

This is what I have come up with so far...However, I am lost with Smarty, so bare with me...

PHP Code:
<?
// Connect to the database
mysql_connect ('localhost''user''pasword') ;
mysql_select_db ('dbname'); 

// Edit this number to however many links you want displaying
$num_displayed ;

// Select random rows from the database
$result mysql_query ("SELECT * FROM links 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"] . "\" border=0 alt=\"" $row["text"] . "\">
</a>" 
;
}
?>
Note: By the time this code is finished, it should display a random product that I can include in my html file using: {include file="nameoftemplate.html"}

Ps: The reason this code won't 'fully compy' with my cart, is because my cart uses the Smarty Template Engine...

Please Respond As Soon As Possible

TIA
-Brian
__________________
Millart's Wonderful World of Vector Art
http://millart.110mb.com/

Last edited by Brian07002 : 05-04-2005 at 05:18 PM.
Brian07002 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Reply     « Reply to Smarty Plugin Needed For Pinnacle Cart...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11083 seconds with 12 queries