php mysql insert error
Posted: Wed Jul 26, 2006 11:38 pm
Hi, im new to php and mysql and am learning from a book called Sams teach yourself "PHP, MySQL and Apache all in one"
The book is ok, and is helping me learn the new stuff. I used to be into access and asp.
Heres my problem, the book has gotten me to write a php script that creates a table named testtable with 2 fields, one is called id and is int not null prmary key auto_increment, the other is called testField and is varchar(75). The create table script works fine.
But when i try the insert script example from the book to insert some data I get an out of range of column error.
The insert code looks like this.
insert into testtable values('', 'some value')
So I guess the problem is that im trying to insert an empty string into an int column type.... this does not make sense, but thats how the book says to do it, and is the same in the code examples that are on a cd that came with the book.
The book is ok, and is helping me learn the new stuff. I used to be into access and asp.
Heres my problem, the book has gotten me to write a php script that creates a table named testtable with 2 fields, one is called id and is int not null prmary key auto_increment, the other is called testField and is varchar(75). The create table script works fine.
But when i try the insert script example from the book to insert some data I get an out of range of column error.
The insert code looks like this.
insert into testtable values('', 'some value')
So I guess the problem is that im trying to insert an empty string into an int column type.... this does not make sense, but thats how the book says to do it, and is the same in the code examples that are on a cd that came with the book.