Re: Saving in a loop

2007-04-03 Thread behrangsa


Thanks,

I solved the problem by nullifying the id in the loop :-)

Looks like the correct way of handling is to call the Create function.

Regards,
Behi


Dr. Tarique Sani wrote:
> 
> 
> On 4/3/07, behrangsa <[EMAIL PROTECTED]> wrote:
>> When I execute the following code, only one item gets inserted into the
>> people table:
>>
>> for ( $counter = 0; $counter <= 4; $counter += 1) {
>>  $this->data['Person']['first_name'] = 'First Name ' . $counter;
>>  $this->data['Person']['last_name'] = 'Last Name ' . $counter;
>>  $this->data['Person']['age'] = 50 + $counter;
>>  $this->Person->save($this->data);
>>   }
> 
> http://groups.google.com/group/cake-php/search?hl=en&group=cake-php&q=saving+in+loop&qt_g=Search+this+group
> 
> Do your homework if you don't want your head to be bitten off ;)
> 
> Tarique
> -- 
> =
> PHP for E-Biz: http://sanisoft.com
> Cheesecake-Photoblog needs you!: http://cheesecake-photoblog.org
> =
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Saving-in-a-loop-tf3509818.html#a9813961
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Saving in a loop

2007-04-02 Thread behrangsa


Hi,

When I execute the following code, only one item gets inserted into the
people table:

for ( $counter = 0; $counter <= 4; $counter += 1) {
 $this->data['Person']['first_name'] = 'First Name ' . $counter;
 $this->data['Person']['last_name'] = 'Last Name ' . $counter;
 $this->data['Person']['age'] = 50 + $counter;
 $this->Person->save($this->data); 
  }

Any ideas why? How can I insert 5 items in a loop like above to the
database?

Regards,
Behi
-- 
View this message in context: 
http://www.nabble.com/Saving-in-a-loop-tf3509818.html#a9803735
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Installing CakePHP on Windows

2007-04-02 Thread behrangsa


Hi,

I figured out what was causing the error: A misplaced .htaccess file. Now
everything works fine.

Regards,
Behi


Ronald Chaplin wrote:
> 
> Hello,
> 
> I use a downloadable solution called WAMP. It is a self extracting package
> that installs Apache PHP5 Mysql4 and some nice tools. As far as I can tell
> from your listing, you should connect to port 80, not 8080. Do you have
> another service running besides Apache like IIS that would be taking
> control
> of port 80? I would highly suggest using WAMP
> http://www.wampserver.com/en/
> 
> I also put each cake project I'm working on in a separate folder as this
> is
> the simplest.
> 
> On 4/1/07, Behi <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi all,
>>
>> I've installed Apache 2.0.59 and PHP 5.2.1 successfully on Windows.
>> I've extracted Cake 1.1.13 to the htdocs directory. But whenever I
>> point my browser to http://localhost:8080/cake/ instead of seeing
>> Cake's default homepage, I see the directory listing. Any ideas what's
>> probably wrong with my configuration? The contents of my httpd.conf
>> file is attached to the end of this post.
>>
>> Thanks in advance,
>> Behi
>>
>> (Note: I am an absolute Apache/PHP newbie!)
>>
>> #
>> # Based upon the NCSA server configuration files originally by Rob
>> McCool.
>> #
>> # This is the main Apache server configuration file.  It contains the
>> # configuration directives that give the server its instructions.
>> # See http://httpd.apache.org/docs/2.0/> for detailed information
>> about
>> # the directives.
>> #
>> # Do NOT simply read the instructions in here without understanding
>> # what they do.  They're here only as hints or reminders.  If you are
>> unsure
>> # consult the online docs. You have been warned.
>> #
>> # The configuration directives are grouped into three basic sections:
>> #  1. Directives that control the operation of the Apache server
>> process as a
>> # whole (the 'global environment').
>> #  2. Directives that define the parameters of the 'main' or 'default'
>> server,
>> # which responds to requests that aren't handled by a virtual
>> host.
>> # These directives also provide default values for the settings
>> # of all virtual hosts.
>> #  3. Settings for virtual hosts, which allow Web requests to be sent
>> to
>> # different IP addresses or hostnames and have them handled by the
>> # same Apache server process.
>> #
>> # Configuration and logfile names: If the filenames you specify for
>> many
>> # of the server's control files begin with "/" (or "drive:/" for
>> Win32), the
>> # server will use that explicit path.  If the filenames do *not* begin
>> # with "/", the value of ServerRoot is prepended -- so "logs/foo.log"
>> # with ServerRoot set to "C:/Apache/Apache2" will be interpreted by
>> the
>> # server as "C:/Apache/Apache2/logs/foo.log".
>> #
>> # NOTE: Where filenames are specified, you must use forward slashes
>> # instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
>> # If a drive letter is omitted, the drive on which Apache.exe is
>> located
>> # will be used by default.  It is recommended that you always supply
>> # an explicit drive letter in absolute paths, however, to avoid
>> # confusion.
>> #
>>
>> ### Section 1: Global Environment
>> #
>> # The directives in this section affect the overall operation of
>> Apache,
>> # such as the number of concurrent requests it can handle or where it
>> # can find its configuration files.
>> #
>>
>> #
>> # ServerRoot: The top of the directory tree under which the server's
>> # configuration, error, and log files are kept.
>> #
>> # NOTE!  If you intend to place this on an NFS (or otherwise network)
>> # mounted filesystem then please read the LockFile documentation
>> (available
>> # at http://httpd.apache.org/docs/2.0/mod/
>> mpm_common.html#lockfile>);
>> # you will save yourself a lot of trouble.
>> #
>> # Do NOT add a slash at the end of the directory path.
>> #
>> ServerRoot "C:/Apache/Apache2"
>>
>> #
>> # ScoreBoardFile: File used to store internal server process
>> information.
>> # If unspecified (the default), the scoreboard will be stored in an
>> # anonymous shared memory segment, and will be unavailable to third-
>> party
>> # applications.
>> # If specified, ensure that no two invocations of Apache share the
>> same
>> # scoreboard file. The scoreboard file MUST BE STORED ON A LOCAL DISK.
>> #
>> #ScoreBoardFile logs/apache_runtime_status
>>
>> #
>> # PidFile: The file in which the server should record its process
>> # identification number when it starts.
>> #
>> PidFile logs/httpd.pid
>>
>> #
>> # Timeout: The number of seconds before receives and sends time out.
>> #
>> Timeout 300
>>
>> #
>> # KeepAlive: Whether or not to allow persistent connections (more than
>> # one request per connection). Set to "Off" to deactivate.
>> #
>> KeepAlive On
>>
>> #
>> # MaxKeepAliveRequests: The maximum number of requests to allow
>> # during a persistent connection. Set to 0 to allow an