coppermine-gallery.com/forum

Support => Older/other versions => cpg1.1d PHPnuke Support (deprecated) => Topic started by: stefanlo on October 22, 2003, 03:38:27 PM

Title: Random Picture Block
Post by: stefanlo on October 22, 2003, 03:38:27 PM
Hi !

I've got a problem building an "Last Picture Block". I always get this message:

mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/ww6165/html/blocks/block-Last_pictures.php on line 39

Is there anybody outthere who may help me? I can't fnd a soution...

Thanks in Advance

Stefan :?:  :?:
Title: Random Picture Block
Post by: DJMaze on October 22, 2003, 07:06:37 PM
global $prefix, $dbi;
$result = sql_query("SELECT pid, filepath, filename FROM cpg_pictures ORDER BY pid DESC LIMIT $length", $dbi);
if (mysql_num_rows($result) <= 0) {

i'm interested in your $result = sql_query() line so post it here
Title: Random Picture Block
Post by: stefanlo on October 23, 2003, 08:08:49 AM
Here it is (and a little bit more..). In the Subject i wrote "Random Picture Block" but i should be "Last Picture Block". Sorry.

$result = sql_query("SELECT pid, filename FROM nuke_CPGpictures ORDER BY pid DESC LIMIT $length", $dbi);

        if (mysql_num_rows($result) <= 0) {
        $content = "No pictures...";
                return false;
        }

        while ($row = mysql_fetch_array($result)) {
                $content .= "<a href=\"modules.php?name=coppermine&file=displayimage&album=lastup&pid={$row['pid']}\">" . truncate_string3($row['filename']) . "</a><br>\n";
        }

$content .= "<center><a href=\"modules.php?name=coppermine\">Go to gallery</a></center>";
?>

Thanks for your help !

Stefan
Title: Random Picture Block
Post by: DJMaze on October 23, 2003, 08:20:54 AM
FROM nuke_CPGpictures that's the wrong table.
it must be cpg_pictures or did you alter the database table names ?
Title: Random Picture Block
Post by: stefanlo on October 23, 2003, 09:21:22 AM
ok, now I've got a listing of the last pictures, but if click on a link of these pictures, the coppermine gallery is telling me, that the picture or the album isn't there.

Stefan