Page 1 of 1
help understanding error message
Posted: Wed Feb 06, 2008 5:34 pm
by bloodl
Hi all!
I have an PHP image catalogue with an admin and front end. In the admin, I upload the files one by one into a designated ID, but I get this error when uploading:
Code: Select all
1366 - Incorrect integer value: '' for column 'image_id' at row 1
insert into og_speakers_image (image_id, speakers_id) values ('', 'EWLB01')
[TEP STOP]
The url stays the same.
Is it the database? Bad coding? Permissions? The file name is correct, and this php image catalogue apparently worked on apache (its now using IIS).
Can anyone understand what this means on first inspection?
Cheers,
Doug
Re: help understanding error message
Posted: Wed Feb 06, 2008 6:26 pm
by califdon
bloodl wrote:Hi all!
I have an PHP image catalogue with an admin and front end. In the admin, I upload the files one by one into a designated ID, but I get this error when uploading:
Code: Select all
1366 - Incorrect integer value: '' for column 'image_id' at row 1
insert into og_speakers_image (image_id, speakers_id) values ('', 'EWLB01')
[TEP STOP]
The url stays the same.
Is it the database? Bad coding? Permissions? The file name is correct, and this php image catalogue apparently worked on apache (its now using IIS).
Can anyone understand what this means on first inspection?
Cheers,
Doug
The error messages usually mean exactly what they say. This one says that ' ' is not an integer value, which is no doubt the data type of your field image_id in the table. If you don't pass the correct data type to a field, it will cause an error and tell you exactly what's wrong. In other words, you have to supply an integer value for that field. It's surely the Primary Key for the table and you must either supply a value, or if it is an auto_increment field, omit the field name and the value from your INSERT SQL statement.
Re: help understanding error message
Posted: Wed Feb 06, 2008 8:47 pm
by bloodl
Thanks for your response! Very insightful - it just raised more question for me
The problem is that all I am doing is using a simple "browse" & "upload" function. I am not using any other variables apart from the hard-coded ones which pre-exist.
The developer had it working on his machine, then we put it on ours - apparently it was working fine before.
Is it possible that the error explanation you gave me previously could have been caused by differing php versions?
Cheers,
Doug
Re: help understanding error message
Posted: Thu Feb 07, 2008 10:33 am
by califdon
bloodl wrote:Thanks for your response! Very insightful - it just raised more question for me
The problem is that all I am doing is using a simple "browse" & "upload" function. I am not using any other variables apart from the hard-coded ones which pre-exist.
The developer had it working on his machine, then we put it on ours - apparently it was working fine before.
Is it possible that the error explanation you gave me previously could have been caused by differing php versions?
Cheers,
Doug
No. It is abundantly clear:
Code: Select all
# 1366 - Incorrect integer value: '' for column 'image_id' at row 1
insert into og_speakers_image (image_id, speakers_id) values ('', 'EWLB01')
The INSERT statement says that MySQL should insert a row into the table og_speakers_image, with two values to be filled in the columns image_id and speaker_id. Then the values to be inserted are specified: '' (that is, a zero-length string) and the string 'EWLB01'. The error message is telling you that '' is an incorrect integer value, in fact it is not an integer at all, it is a string. It would be an error in any version of any database engine that has ever been released. As you have presented it here, it is impossible for that code to have worked on anybody's machine, assuming that the table og_speakers_image was defined to have an integer in the image_id field.
Re: help understanding error message
Posted: Thu Feb 07, 2008 8:22 pm
by bloodl
Cool, thanks for that! I will look into it
Thanks for your help
Re: help understanding error message
Posted: Fri Feb 08, 2008 12:44 am
by bloodl
... okay issues is fixed. The developer has said that going from php4 to 5 caused issues with auto incrementing? I don't get it. Can you make sense of this califdon?
Re: help understanding error message
Posted: Fri Feb 08, 2008 1:05 am
by califdon
bloodl wrote:... okay issues is fixed. The developer has said that going from php4 to 5 caused issues with auto incrementing? I don't get it. Can you make sense of this califdon?
I'm glad it's resolved. But no, I'd have to ask him what kind of issues. My first guess is that he changed something, because I don't see how the script you showed us could ever work, since it appears to me that it was sending a zero-length string as the value for an integer field. That isn't an auto incrementing issue. And auto incrementing is a MySQL function and has nothing to do with PHP.