Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
xGSTQ
Involved
Involved


Joined: Feb 03, 2006
Posts: 267
Location: UK

PostPosted: Tue May 30, 2006 3:02 pm Reply with quote

Hi,

This is my problem:

I am trying to edit the current E-Solution Random product block which just shows 1 random product.
I would like it to show 4-5 random products but for the life of me get it all wrong...

Yes i can repeat the code and get, 2 images the same !! lol

If any one can help me i would be ever gratefull thanks..

Ill post the code of the block here

Code:
<?php


if (eregi("block-Esolution_random_product.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
global $db,$prefix;

$content.="";
$getrandomproduct=$db->sql_query("
SELECT
lid,title,image,price,currency
FROM
".$prefix."_royal_memberships_downloads_deluxe
WHERE sale=1
AND active > 0
ORDER BY RAND()
LIMIT 1
");

if ($getrandomproduct > 0)
{
list($lid,$title,$image,$price,$currency)=$db->sql_fetchrow($getrandomproduct);

$content.="<table width='100%' align='center'>";
$content.="<tr><td align='center'><a href='modules.php?name=Digital_Goods&amp;op=getdetailed&amp;getdetailed&amp;lid=$lid'>".stripslashes($title)."</a></td></tr>";
$content.="<tr><td align='center' valign='middle'>";
if (file_exists("modules/E-Solution/$image")){
$content.="<a href='modules.php?name=Digital_Goods&amp;op=getdetailed&amp;getdetailed&amp;lid=$lid'><img src='modules/E-Solution/".$image."' border='0'></a>";
}
$content.="</td></tr>";
$content.="<tr><td align='center'>".$price."".$currency;

$content.="</td></tr></table>";
}
else{
$content.="<center>No Goods for sale yet!</center>";
}
 
View user's profile Send private message Send e-mail Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6383

PostPosted: Tue May 30, 2006 8:05 pm Reply with quote

Try this (note: the limit 5 determines how many to display):
Code:
<?php


if (eregi("block-Esolution_random_product.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}
global $db,$prefix;

$content.="";
$getrandomproduct=$db->sql_query("
SELECT
lid,title,image,price,currency
FROM
".$prefix."_royal_memberships_downloads_deluxe
WHERE sale=1
AND active > 0
ORDER BY RAND()
LIMIT 5
");

if ($getrandomproduct > 0)
{
$content.="<table width='100%' align='center'>";
while (list($lid,$title,$image,$price,$currency)=$db->sql_fetchrow($getrandomproduct)) {

$content.="<tr><td align='center'><a href='modules.php?name=Digital_Goods&amp;op=getdetailed&amp;getdetailed&amp;lid=$lid'>".stripslashes($title)."</a></td></tr>";
$content.="<tr><td align='center' valign='middle'>";
if (file_exists("modules/E-Solution/$image")){
$content.="<a href='modules.php?name=Digital_Goods&amp;op=getdetailed&amp;getdetailed&amp;lid=$lid'><img src='modules/E-Solution/".$image."' border='0'></a>";
}
$content.="</td></tr>";
$content.="<tr><td align='center'>".$price."".$currency;

$content.="</td></tr>";
}
$content.="</table>";
}
else{
$content.="<center>No Goods for sale yet!</center>";
}

_________________
I google, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
xGSTQ
PostPosted: Wed May 31, 2006 2:12 am Reply with quote

OMG it worked !! lol

im sure i tried that you know .... thank you ever so much...

Its curently a vertical block im going to play and make it horizontal block !!

RavensScripts
 
xGSTQ
PostPosted: Wed May 31, 2006 2:51 am Reply with quote

hmm... i tried around 3 diffrent ways but what ever i tried the images are always on top of each other i bet to get the images side by side would be a little complicated re write.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©