forum.coppermine-gallery.net

Support => Older/other versions => cpg1.2 PHPnuke/Postnuke Support => Topic started by: gazraa on November 18, 2003, 11:49:43 am

Title: [SOLVED] blocks sql problem
Post by: gazraa on November 18, 2003, 11:49:43 am
i'm using nuke 6.7 with all security patches
just installed coppermine 1.2 rc2

no problem.

i want to use the block for random pictures in the center of nuke, but it looks like the sql queries in the blocks don't use the database prefix set in the config.inc.php

i'm not a php expert, but am learning and can understand most of what the code does.

Can someone give me a hand in getting the block-center-Random_pictures.php to work

i get this error at the moment:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ###my path to the file###/block-Random_pictures.php on line 49

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ###my path to the file###/block-Random_pictures.php on line 60
Title: SQL Statement in blocks.
Post by: RedGerry on November 26, 2003, 05:11:04 pm
The SQL statement in the block is presuming that you have the default directory cpg_pictures. If, like me, you renamed your install then you have to modify two lines of code to get this to work..

Around line 48
$result = sql_query("SELECT count(*) from nuke_cpgpictures", $dbi);

Around line 59
$result2 = sql_query("SELECT pid, aid, filepath, filename  from nuke_cpgpictures WHERE approved='YES' LIMIT $random_number,1", $dbi);

The two bits in bold are the correction for MY config where I kept the nuke prefix and stuck the cpg after the _ to keep all the cpg tables together.

Edit to suit your tables.
Title: [SOLVED] blocks sql problem
Post by: gazraa on November 26, 2003, 05:23:16 pm
hmmmm when I made that change for my config I get this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /path to my file/blocks/block-Random_pictures.php on line 49

any ideas?
Title: [SOLVED] blocks sql problem
Post by: DJMaze on November 26, 2003, 06:49:19 pm
Upgrade to RC3 it has mass changes.