I want to say thanks also, Ben.   This was really annoying me.   I
started using Cake to save time, not lose time on frustrations like
this!   I know it wasn't a really a Cake issue, but still...
//spk


On Feb 10, 2:22 pm, asturges <[EMAIL PROTECTED]> wrote:
> Thanks Ben, I was having the same problem. I knew it had to be
> something with MySQL, and not with Cake's scaffolding. For anyone else
> having this problem, edit the MySQL configuration file, which is
> probably called my.ini, and is located in the MySQL installation
> directory (if you're running windows). In the line that says
>
> # Set the SQL mode to strict
> sql-mode="STRICT_TRANS_TABLES,
> NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
>
> take out the "STRICT_TRANS_TABLES" part (and delete the comma). This
> was included in the default installation of MySQL 5.0 on my Windows XP
> machine. No one else on the IRC seemed to be having the same problem,
> so perhaps my installation was not typical. Be aware that this allows
> some data to slip into MySQL that would have otherwise been forbidden.
> For more information 
> see,http://dev.mysql.com/doc/refman/5.0/en/constraint-invalid-data.html.
>
> -Andrew
>
> On Jan 6, 6:43 pm, Ben Coleman <[EMAIL PROTECTED]> wrote:
>
> > OK I've found the problem and the fix...
>
> > It's caused by the version of MySQL - in v5.1the default SQL mode is
> > STRICT_TRANS_TABLES which causes thiserror. If you remove this
> > setting from the MySQL config it will let you use '' instead of NULL
> > and the Cake code works OK.
>
> > Ben
>
> > On Jan 6, 7:26 pm, Ben Coleman <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > Just got back into using Cake after some time away from it (and PHP
> > > development in general) I want to knock up an app very quickly so I
> > > want to use the scaffolding. I have a very simple table, model &
> > > controller defined but when I come to add an item I always get this
> > >error:
>
> > > SQLError:1366: Incorrect integer value: '' forcolumn'id' atrow1
>
> > > I've defined my table as follows:
>
> > > CREATE TABLE genres (
> > >    idINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
> > >     name VARCHAR(50)
> > > );
>
> > > But it seems like the default scaffolding is not using the correct SQL
> > > for theidfield, how can I get round this?
> > > I'm using MySQL 5.0 and PHP 5.2
>
> > > Any advice is appreciated!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to