|
Posted by Pedro Graca on 11/20/06 00:17
Jerry Stuckle wrote:
> Norman Peelman wrote:
>> "so many sites so little time" <kkddrpg@gmail.com> wrote in message
>> news:1163951865.217385.224180@m73g2000cwd.googlegroups.com...
>>>// Define the query.
>>>$query = "INSERT INTO home (home_id, header, body, date_entered)
^==1==^ ^==2=^ ^=3^ ^=====4====^
>>>VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
^=========1========^ ^========2=======^ ^=3=^
ERROR 1136 (21S01): Column count doesn't match value count ...
4 columns (home_id, header, body, and date_entered) and 3 values give
the error 1136 in my MySQL (v 4.1.10)
>> First problem is you are not entering your home_id at all (it takes a 0 -
>> zero or a NULL to work), make your $query look like this:
>
> Incorrect. It is perfectly valid to not enter home_id in the INSERT
> statement. The autonum value will be used.
I agree with Norm :)
The SQL statement from "so many sites so little time" generates an
error.
The only way to make it valid is to eliminate it from the column
specification:
$query = "INSERT INTO home (header, body, date_entered)
VALUES ('{$_POST['header']}', '{$_POST['body']}', NOW())";
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Navigation:
[Reply to this message]
|