grazie Filippo
Invio il codice per chi fosse interessato o se qualcuno ha consigli su come migliorarlo
Codice PHP:
<?php while (gallery_get_previews('random', 6)) : ?>
<div>
[url="<?php gallery_image_link() ?>"][img]<?php gallery_image_url('thumb'); ?>[/img][/url]
<?php gallery_image_title(); ?>
</div>
<?php endwhile; ?>
la funzione
Codice PHP:
function gallery_get_previews($method, $quantity)
{
// the following variable is the resource of the query, it must be unique to this function
global $gallery_get_previews_result;
global $conn, $row;
// prepare query statement
$sql = "SELECT * FROM images";
$sql .= " ORDER BY id_image ASC ";
if($quantity) $sql .= " LIMIT ".$quantity;
if(!$gallery_get_previews_result)
{
$gallery_get_previews_result = mysql_query($sql, $conn);
}
$row = mysql_fetch_object($gallery_get_previews_result);
return $row;
// free the result
mysql_free_result($gallery_get_previews_result);
}