News:

CPG Release 1.6.28
added submissions from {406man}
cleaned up a few PHP (8.4) deprecations
fixed PHP deprecation in calendar
removed security vulnerability
(please upgrade when possible)

Main Menu

Random Picture Block

Started by stefanlo, October 22, 2003, 03:38:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

stefanlo

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 :?:  :?:

DJMaze

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
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

stefanlo

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

DJMaze

FROM nuke_CPGpictures that's the wrong table.
it must be cpg_pictures or did you alter the database table names ?
There are 2 kinds of users in this world: satisfied and complainers.
Why do we never hear something from the satisfied users?
http://coppermine-gallery.net/forum/index.php?topic=24315.0

stefanlo

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