forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: pacimir on February 06, 2006, 02:47:25 pm

Title: Database error
Post by: pacimir on February 06, 2006, 02:47:25 pm
Then I click to http://*********.com/index.php?cat=1 i get an error There was an error while processing a database query
I made some modifications before 2-3 weeks and now a user told me for this problem. I no other place there is no such an error.
Where to look for the problem :)
Title: Re: Database error
Post by: Nibbler on February 06, 2006, 02:52:25 pm
Enable debug mode in config, navigate to the problem page and post the mysql error message that you get, not the entire debug output.
Title: Re: Database error
Post by: pacimir on February 06, 2006, 04:47:44 pm
While executing query "AND category >= 10000 GROUP BY user_id ORDER BY user_name" on 0

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND category >= 10000 GROUP BY user_id ORDER BY user_name' at line 1
Title: Re: Database error
Post by: Nibbler on February 06, 2006, 05:09:33 pm
See if temporarily switching to an unmodified version of index.php fixes it. Make sure you didn't use an = instead of a .= somewhere when you made the modifications.
Title: Re: Database error
Post by: pacimir on February 06, 2006, 08:27:46 pm
I replaced my Index.php with a original one and there is no effect   :o
Title: Re: Database error
Post by: Stramm on February 07, 2006, 05:02:17 pm
in index.php find the function list_users

replace the var $sql with
Code: [Select]
       $sql = "SELECT owner_id as user_id, " .
               "owner_name as user_name, " .
               "COUNT(DISTINCT a.aid) as alb_count, " .
               "COUNT(DISTINCT pid) as pic_count, " .
               "MAX(pid) as thumb_pid " .
               "FROM {$CONFIG['TABLE_ALBUMS']} AS a  " .
               "INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON (p.aid = a.aid AND approved = 'YES') ";
        if ($FORBIDDEN_SET != "") $sql .= "WHERE $FORBIDDEN_SET ";
        $sql .= "AND category >= " . FIRST_USER_CAT . " GROUP BY user_id " .
                "ORDER BY thumb_pid DESC"; // order by last uploaded
                //"ORDER BY user_name"; // order by user name

and please tell me if it works
Title: Re: Database error
Post by: pacimir on February 08, 2006, 10:07:00 am
NO effect :(

I attached a copy of my current index.php , with tihs correction above
Title: Re: Database error
Post by: Joachim Müller on February 08, 2006, 10:09:56 am
upgrade at least to cpg1.3.5
Title: Re: Database error
Post by: pacimir on February 12, 2006, 03:55:46 pm
It is 1.35 from months :)
Title: Re: Database error
Post by: Nibbler on February 12, 2006, 04:14:33 pm
index.php says 1.3.3

uncomment this line

Code: [Select]
//                $sql = "SELECT owner_id as user_id, " .
Title: Re: Database error
Post by: pacimir on February 12, 2006, 07:54:11 pm
Worked!

You are the best support for free script!