Error While executing query "INSERT INTO album_hit_stats ..." Error While executing query "INSERT INTO album_hit_stats ..."
 

News:

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

Main Menu

Error While executing query "INSERT INTO album_hit_stats ..."

Started by derekrodgers, April 03, 2006, 03:08:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

derekrodgers

For reference, my gallery is at http://album.derekrodgers.info/

I am running CPG version 1.4.2

I recently moved coppermine to my new hosting provider, which entailed moving the database and files over, as well as excecuting the relocate_server.php script. This all seemed to go fine, and the front page as well as album thumbnail views both worked fine. But then , disaster strikes when I click on an image. As soon as viewimage.php loads, I get the oh so helpful "There was an error while processing a database query." message. I turned on debug mode, and this is what I got for the error:

While executing query "INSERT INTO album_hit_stats
                          SET
                            pid = 44,
                            search_phrase = '',
                            Ip   = '24.224.184.26',
                            sdate = '1144025816',
                            referer='http://album.derekrodgers.info/thumbnails.php?album=6',
                            browser = 'Firefox',
                            os = 'Windows XP'" on 0

mySQL error: Duplicate entry '0' for key 1

(File: /home/.dimitri/derekrodgers/album.derekrodgers.info/include/functions.inc.php - Line: 248 )


The rest of the debug info looks like this:
USER:
------------------
Array
(
    [ID] => caa3ed05183122933f42711cb4941fe7
    [am] => 1
    [lang] => english
    [liv] => Array
        (
            [0] => 93
            [1] => 115
            [2] => 111
            [3] => 102
            [4] => 16
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 0
    [user_name] => Guest
    [groups] => Array
        (
            [0] => 3
        )

    [group_quota] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 0
    [can_post_comments] => 0
    [can_upload_pictures] => 0
    [can_create_albums] => 0
    [pub_upl_need_approval] => 1
    [priv_upl_need_approval] => 1
    [upload_form_config] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [custom_user_upload] => 0
    [disk_max] => 0
    [disk_min] => 0
    [ufc_max] => 0
    [ufc_min] => 0
    [has_admin_access] => 0
    [group_name] => Anonymous
    [can_see_all_albums] => 0
    [group_id] => 3
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM album_filetypes; (0.001s)
    [1] => select * from album_plugins order by priority asc; (0.001s)
    [2] => delete from `derek_album`.album_sessions where time<1144022216 and remember=0; (0.001s)
    [3] => delete from `derek_album`.album_sessions where time<1142816216; (0s)
    [4] => select user_id from `derek_album`.album_sessions where session_id=md5("95cb056f18af42e2916286c4a96f82e6587c66a5f38b58b3310db0ff076017df"); (0.001s)
    [5] => select user_id as id, user_password as password from `derek_album`.album_users where user_id=0 (0s)
    [6] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM album_usergroups WHERE group_id in (3) (0.001s)
    [7] => SELECT group_name FROM  album_usergroups WHERE group_id= 3 (0s)
    [8] => update `derek_album`.album_sessions set time='1144025816' where session_id=md5('95cb056f18af42e2916286c4a96f82e6587c66a5f38b58b3310db0ff076017df'); (0s)
    [9] => DELETE FROM album_banned WHERE expiry < '2006-04-03 00:56:56' (0s)
    [10] => SELECT * FROM album_banned WHERE (ip_addr='24.224.184.26' OR ip_addr='24.224.184.26' OR user_id=0) AND brute_force=0 (0s)
    [11] => SELECT aid FROM album_albums WHERE visibility != '0' AND visibility !='10000' AND visibility NOT IN (3) (0s)
    [12] => SELECT aid FROM album_albums (0s)
    [13] => SELECT title,keyword from album_albums WHERE aid='6' (0s)
    [14] => SELECT COUNT(*) from album_pictures WHERE (aid='6'  )  AND approved='YES' AND aid IN (3,4,5,6,7)  (0s)
    [15] => SELECT * from album_pictures WHERE (aid='6'  )  AND approved='YES' AND aid IN (3,4,5,6,7)  ORDER BY filename ASC  LIMIT 5 ,1 (0.001s)
    [16] => SELECT title, comments, votes, category, aid FROM album_albums WHERE aid='6' LIMIT 1 (0s)
    [17] => SELECT name, parent FROM album_categories WHERE cid = '2' (0s)
    [18] => UPDATE album_pictures SET hits=hits+1, lasthit_ip='24.224.184.26', mtime=CURRENT_TIMESTAMP WHERE pid='44' (0s)
    [19] => INSERT INTO album_hit_stats
                          SET
                            pid = 44,
                            search_phrase = '',
                            Ip   = '24.224.184.26',
                            sdate = '1144025816',
                            referer='http://album.derekrodgers.info/thumbnails.php?album=6',
                            browser = 'Firefox',
                            os = 'Windows XP' (0s)
    [20] => SELECT COUNT(*) FROM album_pictures WHERE approved = 'NO' (0.001s)
)

==========================
GET :
------------------
Array
(
    [album] => 6
    [pos] => 5
)

==========================
POST :
------------------
Array
(
)

==========================
Page generated in 0.133 seconds - 21 queries in 0.007 seconds - Album set : AND aid IN (3,4,5,6,7) ; Meta set: AND aid IN (3,4,5,6,7) ;




From what the first part told me (and if it isn't obvious already, I'm not all that comfortable with mySQL), it seemed that there was a problem with duplicate feilds in the table "album_hit_stats." I tried deleting all the feilds in there, since it was just stats I didn't need/care about anyway. No use. I restored the database and everything is now exactly as it was on my old server.

Feel free to have a look at the album to see for yourself, debug mode is still on.

Any ideas what might be causing this problem?

Joachim Müller


derekrodgers

I get this mySQL error in phpmyadmin when i attempt to set pid to auto_increment:

Error

SQL query:

ALTER TABLE `album_hit_stats` CHANGE `pid` `pid` VARCHAR( 100 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL AUTO_INCREMENT

MySQL said: Documentation
#1063 - Incorrect column specifier for column 'pid'


What am I doing wrong?