Jump to content

Recommended Posts

The result of below code can be seen on http://www.crocgame.com under Recommended Games (between purple on top)

My Question: Is it possible adjusting my code here and there, to show 5 new games after a certain time duration on the same index page so that images and corresponding urls (purple buttons) rotate on the webpage and it will be less boaring.

Anyone who helps me fix this can get 15 dollar on your paypal because i think you need to put some work in it.

Best regards,

Kurt

 

 

 

 

<?php
$iKolommen = 5;
?>
      <?php
              include_once("config.php");                           
              ?>
              <?php
              $rQuery = mysql_query("SELECT * FROM " . $pre . $sqlgame . " WHERE  (name LIKE '%candy crush%') OR (name LIKE '%goodgame farmer%') OR (name LIKE '%rummy%') OR (name LIKE '%goodgame empire%') OR (name LIKE '%Gorillaz Tiles%') OR (name LIKE '%goodgame shadow kings%') OR (name LIKE '%my free zoo%') OR (name LIKE '%my free farm%') OR (name LIKE '%kapi hospital%') OR (name LIKE '%garbage garage%')  OR (name LIKE '%11 legends%') OR (name LIKE '%dansen met de sterren%') OR (name LIKE '%skyrama%') OR (name LIKE '%seafight%') OR (name LIKE '%battlestar galactica%') OR (name LIKE '%pirate storm%') OR (name LIKE '%rising cities%') OR (name LIKE '%zoo mumba%') OR (name LIKE '%drakensang online%') OR (name LIKE '%uptasia%') ORDER BY RAND() LIMIT 5");
              $iCount = mysql_num_rows($rQuery);
              ?>
              <?php
              if(!$iCount)
              {
                ?>
                  <span style="color: white; text-align: center;">No games were found.</span>
                <?php
              }
              else
              {
                ?>
                <table width="780" cellpadding="0" cellspacing="0" align="center">
                  <tr>
                    <?php
                    $i = 1;
                    while($aGame = mysql_fetch_assoc($rQuery))
                    {
                      ?>
                      <td width="<?php echo (100 / $iKolommen); ?>%" align="center" style="text-align: center;">
                        <?php
                        if($aGame['cijfer'] != 0 AND $aGame['stemmen'] != 0)
                        {
                          $iCijfer = floor($aGame['cijfer'] / $aGame['stemmen']);
                        }
                        else
                        {
                          $iCijfer = 0;
                        }
                        $sSpelUrl = str_replace(" ", "-", $aGame['name']);
                        ?>
       <div style="float: left; margin-left:2px; width: <?php echo ($i == 2 OR $i == 3) ? "152" : "153"; ?>px; text-align: center;">
                        <a target="_blank" href="http://www.crocgame.com/games.php/<?php echo $sSpelUrl; ?>.html" class="recommendedLink">
                          <span class="iconwrapper"><img src="<?php echo $aGame['screenshoturl']; ?>" width="140" height="89" alt="recommend games" /></span>
                          <span class="recomendedButton" style="margin: 5px auto auto auto;">
                  <?php echo strlen($aGame['name']) > 19 ? substr($aGame['name'], 0, 19) . ".." : $aGame['name']; ?>
                  </span>
              </a>
          </div></td>     

?>

Link to comment
https://forums.phpfreaks.com/topic/297780-rotating-5-images-in-php/
Share on other sites

Please use the code tags [ code ] [ / code ] when pasting code on the forum it makes it easier to read. 

Like such: 

 

 

<?php
$iKolommen = 5;
?>
      <?php
              include_once("config.php");                           
              ?>
              <?php
              $rQuery = mysql_query("SELECT * FROM " . $pre . $sqlgame . " WHERE  (name LIKE '%candy crush%') OR (name LIKE '%goodgame farmer%') OR (name LIKE '%rummy%') OR (name LIKE '%goodgame empire%') OR (name LIKE '%Gorillaz Tiles%') OR (name LIKE '%goodgame shadow kings%') OR (name LIKE '%my free zoo%') OR (name LIKE '%my free farm%') OR (name LIKE '%kapi hospital%') OR (name LIKE '%garbage garage%')  OR (name LIKE '%11 legends%') OR (name LIKE '%dansen met de sterren%') OR (name LIKE '%skyrama%') OR (name LIKE '%seafight%') OR (name LIKE '%battlestar galactica%') OR (name LIKE '%pirate storm%') OR (name LIKE '%rising cities%') OR (name LIKE '%zoo mumba%') OR (name LIKE '%drakensang online%') OR (name LIKE '%uptasia%') ORDER BY RAND() LIMIT 5");
              $iCount = mysql_num_rows($rQuery);
              ?>
              <?php
              if(!$iCount)
              {
                ?>
                  <span style="color: white; text-align: center;">No games were found.</span>
                <?php
              }
              else
              {
                ?>
                <table width="780" cellpadding="0" cellspacing="0" align="center">
                  <tr>
                    <?php
                    $i = 1;
                    while($aGame = mysql_fetch_assoc($rQuery))
                    {
                      ?>
                      <td width="<?php echo (100 / $iKolommen); ?>%" align="center" style="text-align: center;">
                        <?php
                        if($aGame['cijfer'] != 0 AND $aGame['stemmen'] != 0)
                        {
                          $iCijfer = floor($aGame['cijfer'] / $aGame['stemmen']);
                        }
                        else
                        {
                          $iCijfer = 0;
                        }
                        $sSpelUrl = str_replace(" ", "-", $aGame['name']);
                        ?>
       <div style="float: left; margin-left:2px; width: <?php echo ($i == 2 OR $i == 3) ? "152" : "153"; ?>px; text-align: center;">
                        <a target="_blank" href="http://www.crocgame.com/games.php/<?php echo $sSpelUrl; ?>.html" class="recommendedLink"> 
                          <span class="iconwrapper"><img src="<?php echo $aGame['screenshoturl']; ?>" width="140" height="89" alt="recommend games" /></span>
                          <span class="recomendedButton" style="margin: 5px auto auto auto;">
                  <?php echo strlen($aGame['name']) > 19 ? substr($aGame['name'], 0, 19) . ".." : $aGame['name']; ?>
                  </span>
              </a>
          </div></td>     
?>

From what I gather from your description it sounds like you need javascript help not PHP. 

You can always google rotating images javacript or jquery and you should find some helpful info here. 
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.