Wednesday, May 23, 2012

Re: Storing multidimensional Array into Database

On Wed, May 23, 2012 at 12:21 PM, Teji <teji.infin@gmail.com> wrote:
> Hello Everyone..
>
> i have an array whose print_r() output is
> Array ( [deadlines] => Array ( [deadline] => Array ( [0] => Array
> ( [date] => 12/10/2011 [text] => My First Project Completed ) [1] =>
> Array ( [date] => 12/2/2012 [text] => have to do something ) [2] =>
> Array ( [date] => 12/5/2012 [text] => hv done something new ) ) ) )
>
> i want to store it in my database.. how can i store it in my database.
>

Assuming you're using a MySQL database, this would work

CREATE TABLE deadlines (
id int(11) NOT NULL, auto_increment,
text varchar(100) NOT NULL,
date datetime,
PRIMARY KEY (id)
);

INSERT INTO deadlines (text, date) VALUES ("My First Project
Completed", "2011-10-12 00:00:00");

Is this what you mean?
This isn't really a cakePHP question at all, nor even a PHP question.

Mike.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: