wow your good....i'll give it a shot

thx. i appreciate it :)

On 10 Aug., 18:39, cricket <zijn.digi...@gmail.com> wrote:
> On Tue, Aug 10, 2010 at 12:30 PM, Tomfox Wiranata
>
> <tomfox.wiran...@gmail.com> wrote:
> > thx to both..
> >  :)
>
> > @cricket:
>
> > am i getting it right? you are writing all numers from the database
> > into an array and compare both? is it possible that at a certain point
> > it will get to big or too much data? cause my range starts at
> > 111111111 and ends at 999999999
>
> > if there are 50million in the table they all get saved in an array....
>
> Yes, that's correct. I should have pointed that out. You could cache
> the results, of course, but perhaps a better way would be to pass
> $new_number to a protected method (that does a find() and comparison)
> inside the while section. You'd have to have the separate method
> because while() isn't a block, where you can have several lines of
> code. Something like:
>
> public function getNewNumber()
> {
>         do
>         {
>                 $new_number = rand(10,100000);
>         }
>         while ($this->_testNewNumber($new_number));
>
>         return $new_number;
>
> }
>
> protected function _testNewNumber($x)
> {
>         // return $x exists in DB
>
> }

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to