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
https://forums.phpfreaks.com/topic/51017-random-photos/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.