Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



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

Posts: 2,162
Name: ...
Location: ...
Trades: 0
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
__________________
Made2Own

Please login or register to view this content. Registration is FREE

Last edited by Brian07002; 05-04-2005 at 05:18 PM..
Brian07002 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Smarty Plugin Needed For Pinnacle Cart...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.20989 seconds with 12 queries