I'm a newbie, but i think this question is better posted here. I've been working through a Sams book-- Teach Yourself PHP, MySQL and Apache All In One. i'm picking up on it pretty well, but now i've hit an error that i can't seem to pin down. allow me to explain. Currently, i'm working on the "Sample Projects" section of the book-- "real world" application of the PHP functions and PHP / MySQL interaction that the book has covered up to this point.
for this exercise, i'm building a simple mailing list management application. i probably wouldn't be having any problems at all with this-- after all, the idea is to copy the code verbatim from the book, as it illustrates some very basic, yet very useful PHP/ MySQL functions by example. i, of course, couldn't leave well enough alone.
the book's table creation included only two columns. the not null auto-incrementing primary key id, and the not null unique varchar email field. i added what i thought to be a more refined, more practical dimension to the table by creating two additional varchar rows-- one for first name, and one for last name, allowing both fields null values. i thought that i would copy the code from the book, use the html form, which is remarkably neatly included in this single page of code, to insert a few e-mail addresses into the DB, and then go back and really examine what is going on. after i developed an understanding, i wanted to challenge myself to add to the book's code, my text field areas to accept data for my additional MySQL fields. but, i get an error once i click the submit button, so i never made it to any code examination-- i have to figure out how to make it work first.
far from ready to give up, i went back to the code to see if i could figure out what was causing my error, "Column count doesn't match value count at row 1". okay, so i have more columns than this code was expecting. it was written for the primary key, and the email field, and i've added 2 columns, so "column count" must mean that my additional fields are causing this error-- this shouldn't be too hard to figure out... just find the code, and re-write it to allow for my extra columns. but, i've studied the PHP code, and i'm starting to think that the solution lies not in the PHP, but in the MySQL functions. I guess i'm just in a little over my head.
sure, i can go back and do exactly as the book does, and make a new table, but i want to try to figure this out. i might learn something valuable! suggestions?