Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: SQL Query?  (Read 2219 times)

0 Members and 1 Guest are viewing this topic.

LordNeon

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

Hello.

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);
mysql_free_result($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.
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 19 queries.