Ok ive created a form, it passes its values to the processing file fine.

im able to echo all values out no problem, but when i try to put it into a database i get:

Column count doesn't match value count at row 1
$submitby = $_POST['submitby'];
$suspect = $_POST['suspect'];
$reason = $_POST['Reason'];
$details = $_POST['Details'];
$type = $_POST['type'];


$a = "INSERT INTO $table1 values ('','$type','$submitby','$suspect','$reason','$details','$datetime')";
$b = mysql_query($a)or die (mysql_error());

there are 7 lots of data to 7 fields in the db?

ive echo the query its fine, ive ran the query in phpmyadmin, and it write the info fine
any ideas?

    doesn't matter solved the problem 🙂

    what an a$$ i am i was telling it to put it in the wrong table

      Don't forget to use mysql_real_escape_string to avoid database injection.

        And also don't forget that you should always specify a column list in INSERT queries. Relying on MySQL to fill it in for you is risky and not a good habit to get into.

        Also, don't forget to mark this thread resolved.

          Write a Reply...