Hi.
I have the latest coppermine installed, SQL is >4.1, but I still get error message: "There was an error while processing a database query"
My functions.php looks like this:
// Replacing the AND in ALBUM_SET with AND (
if($META_ALBUM_SET){
$TMP_SET = "AND (" . substr($META_ALBUM_SET, 3);
}else{
$TMP_SET = "AND (1";
}
//mod comments
$query_meta_album_set = str_replace( $CONFIG['TABLE_PICTURES'], "p" , $TMP_SET );
$query = "SELECT COUNT(DISTINCT(c.pid)) FROM `cpg148_comments` AS c, `cpg148_pictures` AS p
where p.approved = 'YES' and c.pid = p.pid $query_meta_album_set $keyword);";
$result = cpg_db_query($query);
$nbEnr = mysql_fetch_array($result);
$count = $nbEnr[0];
mysql_free_result($result);
$query = "SELECT p.*, c1.msg_id, c1.author_id, c1.msg_author, c2.msg_date, c1.msg_body, c1.pid
from {$CONFIG['TABLE_PICTURES']} as p,
{$CONFIG['TABLE_COMMENTS']} as c1,
(SELECT pid, MAX(UNIX_TIMESTAMP(msg_date)) as msg_date
from {$CONFIG['TABLE_COMMENTS']}
group by pid
order by msg_date DESC) AS c2
where unix_timestamp(c1.msg_date) = c2.msg_date
and p.approved = 'YES' and c1.pid = p.pid
$query_meta_album_set $keyword)
group by p.pid
order by msg_date DESC
$limit;";
$result = cpg_db_query($query);
//end mod comments
$rowset = cpg_db_fetch_rowset($result);
mysql_free_result($result);
if ($set_caption) build_caption($rowset,array('msg_body','msg_date'));
Is the code o.k.? Where else could be the error?
Thank you very much, Dietmar