cluce Posted May 3, 2007 Share Posted May 3, 2007 I am not sure wants going on here. Both of my fields are varchar(50). Can someone tell me what I am missing? here is the code I am using......... <?php $mysqli = mysqli_connect("localhost", "root", "", "test"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { $sql = "INSERT INTO testTable (testField) VALUES ('".$_POST['testfield']."','".$_POST['testfield2']."')"; $res = mysqli_query($mysqli, $sql); if ($res === TRUE) { echo "A record has been inserted."; } else { printf("Could not insert record: %s\n", mysqli_error($mysqli)); } mysqli_close($mysqli); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/49859-solved-errorcould-not-insert-record-column-count-doesnt-match-value-count-at-row1/ Share on other sites More sharing options...
papaface Posted May 3, 2007 Share Posted May 3, 2007 you have two values for one column name: INSERT INTO testTable (testField) VALUES ('".$_POST['testfield']."','".$_POST['testfield2']."')" Quote Link to comment https://forums.phpfreaks.com/topic/49859-solved-errorcould-not-insert-record-column-count-doesnt-match-value-count-at-row1/#findComment-244595 Share on other sites More sharing options...
cluce Posted May 3, 2007 Author Share Posted May 3, 2007 duhh me, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/49859-solved-errorcould-not-insert-record-column-count-doesnt-match-value-count-at-row1/#findComment-244596 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.