|
Posted by Geoff Muldoon on 11/15/06 01:56
cmw1985@googlemail.com says...
> I thought that
>
> print $sqlquery was the same thing, I can see the query string in one
> case it looks like this
>
> INSERT INTO tnews (id, Title, Body, Date) VALUES
> ('null','12345678ppp','ppp87654321','Wed, 15 Nov 2006 01:20:01 +0000')
>
> the reason its longer is a friend suggested i try doing the query like
> that
>
> one thing is though if i do this
>
> INSERT INTO tnews (id, Title, Body, Date) VALUES
> ('45','12345678ppp','ppp87654321','Wed, 15 Nov 2006 01:20:01 +0000')
>
> and assign 45 where previously the id was blank or null ( i tried both
> blank and null)
>
> the above works and the code is almost identical the only difference is
> that 45, so anyone got any ideas, my table id field is set as primary
> key and auto increment and not null, so why isnt it auto incrementing?
Just leave the id column out of the insert altogether, as it is
autoincrement it doesn't need to be (and shouldn't be) included in the
statement.
Geoff M
Navigation:
[Reply to this message]
|