help understanding error message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bloodl
Forum Commoner
Posts: 48
Joined: Thu Jun 21, 2007 12:33 am

help understanding error message

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: help understanding error message

Post 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.
bloodl
Forum Commoner
Posts: 48
Joined: Thu Jun 21, 2007 12:33 am

Re: help understanding error message

Post 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
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: help understanding error message

Post 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.
bloodl
Forum Commoner
Posts: 48
Joined: Thu Jun 21, 2007 12:33 am

Re: help understanding error message

Post by bloodl »

Cool, thanks for that! I will look into it

Thanks for your help
bloodl
Forum Commoner
Posts: 48
Joined: Thu Jun 21, 2007 12:33 am

Re: help understanding error message

Post 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?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: help understanding error message

Post 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.
Post Reply