Somewhere in your code (or cakephp's), it's getting treated as an
integer, which makes the leading 0 insignificant.  Find where that is,
or use a sprintf to pad it.



On Oct 5, 9:07 am, "Zach Cox" <[EMAIL PROTECTED]> wrote:
> It's a VARCHAR(50), not an INTEGER column.
>
> On 10/5/07, Christian Winther <[EMAIL PROTECTED]> wrote:
>
>
>
> > Try to do
>
> > var_dump(00001);
> > var_dump("00001");
>
> > It?s a PHP issue
>
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Adam 
> > Royle
> > Sent: 5. oktober 2007 12:54
> > To: Cake PHP
> > Subject: Re: Leading Zeros Getting Stripped
>
> > Surely this isn't a PHP issue?? I would say it would be dictated by
> > the column type being numeric. I've used zero-padded values in varchar
> > columns without the issue you're mentioning, so maybe double-check
> > you've got everything setup right.
>
> > Adam
>
> > On Oct 5, 4:51 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > > Thanks for the reference Chris!  I fixed the issue by using str_pad in
> > > the afterFind callback of my model to repair the ISBN.
>
> > > On Oct 4, 2:19 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > > > On 10/4/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > > I'm not sure if this is a CakePHP issue or PHP in general, but I have
> > > > > a table in which I'm storing ISBN numbers in a VARCHAR(32) column.
> > > > > ISBNs can start with a zero (like 0137903952), but my model is
> > > > > returning the ISBN with the leading zero removed.
>
> > > > > Does anyone know why this is occurring, and if there's any way to
> > > > > prevent it?
>
> > > > PHP issue, look into str_pad().
>
> > > > --
> > > > Chris Hartjes
> > > > Cake Development Corporationhttp://www.cakedevelopment.com
>
> > > > My motto for 2007:  "Just build it, damnit!"
>
> > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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