Jump to content

Random Photos


lordphate

Recommended Posts

Okay, so this is what i'm trying to do. I want to pull photo_small and art_id out of the database, but i want to pull them at random

 

here's what I have but it's still listing in same order:

 

[code=php:0]
function tattoo_slide(){



$sql_query="SELECT art_id, photo_small

			FROM tatoo_art WHERE approved='1' ORDER BY RAND() LIMIT 1";

$result = $GLOBALS["DB"]->result($sql_query);
    $tatslide = prepare_photos_array($result);

$tatslide["total"] = count($result);

    $tatslides = array();

$counter = 0;

foreach($result as $res){


$tatslide["links"]   = "http://tatfactory.com/index.php?page=art&section=view&art_id=".$res["art_id"];

	 $tatslide["images"]   = $res["photo_small"];

$conveyor .= 'leftrightslide['.$counter.']=\'<a href="'.$tatslide["links"].'"><img src="/photos/'.$tatslide["images"].'" border=0></a>\';';

$counter +=1;

}//foreach

$GLOBALS["smarty"]->assign("conveyor",$conveyor);

     }         //tattoo_slide

[/code]

Link to comment
Share on other sites

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.