|
Posted by Jerry Stuckle on 11/20/06 02:23
so many sites so little time wrote:
> thanks so much for all the help im going to remove the home_id if that
> doesnt work i am going to make it null all i am really trying to achive
> in the end is a page where a client could enter that they would like
> text on their site to be and update the database with that text and a
> script that would display that text. i went out tonight and bought
> another php book its the php phrasebook by chris wenz. i have quite a
> few books on php and or mysql 4 to be exact and none of them really got
> what i needed for this through to my head but tonight a sat at borders
> with a cup of coffee and read through the section on inserting and
> displaying data from a mysql database from the sections of every single
> php, and php and mysql book that they had in stock and took notes so i
> should be golden if there are anymore problems or errors with this i
> will let you guys know so you can be of help and that you all for
> helping so much you are all really good people for taking the time to
> help me out. : )
> Pedro Graca wrote:
>
>>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*.
>
>
While you're at it, please buy a book on how to post to usenet. You're
making things much harder on yourself in the way you're posting.
If you were posting properly you would get a lot more responses to your
messages.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|