PHP/MySql access issue for relative beginner

software development


Hey all. I’m trying to connect to a database, submitting entries via php, and I get this error:

Error inserting record: Column count doesn’t match value count at row 1

Could someone let me know exactly what this error is telling me?


You’ve done something like this:

INSERT INTO table (col1, col2, col3) VALUES (‘value1’, ‘value2’);

Note that the number of columns (3 in this example) doesn’t match the number of values (2 in this example).



Excellent! I was able to find my error. Thanks for the help!


Hm… I’ve hit another snag, and thought I’d ask here again.

This code:

$sql = "SELECT album_id, album_name, album_desc FROM album WHERE album_id = " . addslahes($_GET[‘album_id’]);

Is returning this error:

Fatal error: Call to undefined function: addslahes() in /home/.geist/usrname/ on line 22

I’ve used almost identical querries including addslashes(); before, and didn’t get this error. Anyone have better eyes than me?


Maybe I’m the one who’s eyes are failing…why is the “.” preceding the addslashes() ?

It doesn’t look like you are concatenating anything to me…



you have “addslahes”, not “addslashes”



Ha! Thankfully someone’s eyes are working well :open_mouth: ! Good catch there, Jonathan.



Heh, no problem. I do that all the time :slight_smile:



Thanks! It’s crazy how you can look at something over and over, and sometimes need someone else to glance at it for two seconds to see you’ve spelled something wrong.


agree with you there - its very frustrating :slight_smile: