Advanced search  


CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Help to make this small plugin work with 1.6.x  (Read 4629 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Country: 00
  • Offline Offline
  • Posts: 17
  • FC
Help to make this small plugin work with 1.6.x
« on: April 16, 2019, 02:16:55 am »

A hostee of mine is using this small plugin to display latest albums updated but does not work with PHP 7.x and CPG 1.6.x, I have tried to make it work but I have been unabled to do so, it reports "unable to connect to database"

Code: [Select]
header("Content-type: application/x-javascript");

$connect mysqli_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass'])
or die('Error connecting to the server');

$connect_db mysqli_select_db($CONFIG['dbname'], $connect)
or die ('Error connecting to the database');

$resultado mysqli_query("SELECT * FROM `cpg_albums` ORDER BY `cpg_albums`.`aid` DESC LIMIT 0 , 6"$connect)
or die('No albums found with this query');
echo 'document.write(\'';
if(mysqli_num_rows($resultado) == 0){
echo 'No albums created';
} else {
echo '<ul id="galbuns">';
while($row mysqli_fetch_array($resultado)){
echo ' ';
$album_id $row['aid'];
$subresult mysqli_query("SELECT * FROM `cpg_pictures` where aid=$album_id order by pid DESC LIMIT 0, 6");

if(mysqli_num_rows($subresult) == 0){
$album_img "";
} else {
while($subrow mysqli_fetch_array($subresult)){
$album_img "".$subrow['filepath'].'thumb_'.$subrow['filename']  .$subrow['datebrowse'];

echo '<li><div class="galtitul"><a href="'.$album_id.' ">'.$row['title'].'</a></div></li>';

echo '';

echo '</ul>';
echo '\');';



  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Help to make this small plugin work with 1.6.x
« Reply #1 on: April 16, 2019, 02:30:55 pm »

it reports "unable to connect to database"

Are you sure it reports exactly that message?
Pages: [1]   Go Up

Page created in 0.018 seconds with 20 queries.