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: SQL Query?  (Read 2227 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Offline Offline
  • Posts: 1
SQL Query?
« on: July 04, 2005, 04:38:27 pm »


I'm writing a function in the theme.php file of my own template.
The goal of this function is to display all albums as links on the left side of my webpage.
I've managed to do that, but a small problem is still there;
I'm only getting one result of the query and there's 26 entries in my database.
For some reason it won't display the whole loop in my function.

Here's my function as for now:
Code: [Select]
function get_album_list() {
global $CONFIG, $template_custom_album_list;

static $template = '';
static $album_list;
if ((!$template)) {
$template = $template_custom_album_list;
//$album_list = template_extract_block($template, 'custom_album_list');

$sql = "SELECT title, aid FROM {$CONFIG['TABLE_ALBUMS']} ORDER BY title ASC";
$result = db_query($sql) OR die(mysql_error());
$rowset = db_fetch_rowset($result);
foreach($rowset AS $key => $row)
$album_name[$key] = $rowset[$key]['title'];
$album_id[$key] = $rowset[$key]['aid'];
$param[$key] = Array('{CUSTOM_ALBUM_NAME}' => $album_name[$key], '{CUSTOM_ALBUM_ID}' => $album_id[$key]);
$custom_album_list = template_eval($template, $param[$key]);
return $custom_album_list;

Thank you in advance.
Pages: [1]   Go Up

Page created in 0.015 seconds with 20 queries.