Yii Framework Forum: Save Data From Form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Save Data From Form how to save array? Rate Topic: -----

#1 User is offline   AndrĂ© Couto 

  • Junior Member
  • Pip
  • Yii
  • Group: Validating
  • Posts: 93
  • Joined: 22-January 11
  • Location:Feira de Santana,Ba

Posted 25 March 2013 - 12:03 PM

Hi!

how to save array?


TABLE PHONE:
INSERT INTO `phone` (`ID_CUSTOMER`, `PHONE`) VALUES
         (5 '(11) 9999-6767'),
         (5 '(11) 9999-9999'),
         (5 '(41) 9999-8888');



Example in form:

<? php echo $ form-> textField ($ model, 'PHONE [1]', array ('size' => 15, 'maxlength' => 15));?>
<? php echo $ form-> textField ($ model, 'PHONE [2]', array ('size' => 15, 'maxlength' => 15));?>
<? php echo $ form-> textField ($ model, 'PHONE [3]', array ('size' => 15, 'maxlength' => 15));?>
0

#2 User is offline   yiqing95 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 586
  • Joined: 27-December 10
  • Location:china

Posted 25 March 2013 - 12:24 PM

there are two simple way :
1. use foreach to do it (you may know how to insert a single item to db :lol: ).
2. just concanate a sql string and execute it (dao and CDbConnection::quoteValue will give you a help) .
0

#3 User is offline   AndrĂ© Couto 

  • Junior Member
  • Pip
  • Yii
  • Group: Validating
  • Posts: 93
  • Joined: 22-January 11
  • Location:Feira de Santana,Ba

Posted 25 March 2013 - 08:53 PM

Solved! Thank you!

View Postyiqing95, on 25 March 2013 - 12:24 PM, said:

there are two simple way :
1. use foreach to do it (you may know how to insert a single item to db :lol: ).
2. just concanate a sql string and execute it (dao and CDbConnection::quoteValue will give you a help) .

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users