Forum Moderators: open

Message Too Old, No Replies

Image Hosting MySQL error - Incorrect integer value

when trying to upload a file

         

NoviceMaster

10:03 pm on Feb 27, 2008 (gmt 0)

10+ Year Member



hi there.
i'm trying a free image hosting script,and
when i press the "Upload" button i get this error :
------------------------------
Error: Incorrect integer value: '' for column 'is_private' at row 1
Error Number: 1366
Query Executed: INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('h1zly4jb0zjvqte0ngtw.jpg', '', '', 'install-windows.jpg');
------------------------------

this colums is set to:

`mmh_file_storage` (`file_id` int(25) NOT NULL auto_increment,
`filename` varchar(30) NOT NULL default '',
`is_private` tinyint(1) NOT NULL default '0',
`gallery_id` int(25) NOT NULL default '0',
`album_id` int(25) NOT NULL default '0',
`file_title` varchar(35) NOT NULL default '',
PRIMARY KEY (`file_id`)
UNIQUE KEY `filename` (`filename`)
) TYPE=MyISAM;";

--------------
please help.... what's the error on " `is_private` tinyint(1) " ?

LifeinAsia

10:15 pm on Feb 27, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You're basically trying to pass a NULL value to is_private (as well as galley_id), but is_private (and gallery_id) can not have a NULL value.

Try the following:
INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('h1zly4jb0zjvqte0ngtw.jpg', 0, 0, 'install-windows.jpg');

NoviceMaster

8:40 pm on Feb 28, 2008 (gmt 0)

10+ Year Member



First ,thank you for your reply, but i'm new to sql,
so if you can tell me what i should change in the table
i would really appreciate it.
oh.. and here is the php mysql query executed:]
--------------------------
$mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); ");
----------------------------
thanks.

NoviceMaster

9:36 pm on Feb 28, 2008 (gmt 0)

10+ Year Member



Never mind. Probleme Solved !
i uploaded the images while i was logged as admin.
i uploaded as a guest and it works no errors! for now.... :)
thanks anyway.