PHP/MySql access issue for relative beginner

software development

#1

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?


#2

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).

Cheers,
Ian


#3

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


#4

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/url.com/edit_album.php on line 22

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


#5

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…

–rlparker


#6

you have “addslahes”, not “addslashes”


Jonathan


#7

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

–rlparker


#8

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


Jonathan


#9

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.


#10

agree with you there - its very frustrating :slight_smile: