Yii Framework Forum: Update Database By Clicking A Button - Yii Framework Forum

Jump to content

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

Update Database By Clicking A Button Rate Topic: -----

#1 User is offline   Trinh Duy Hung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 12

Posted 18 February 2013 - 11:21 PM

Hello everyone!

The situation is described below (picture)
Attached File  Capture.PNG (16.49K)
Number of downloads: 21

After clicking on button with label +, the driver_point column's value that comes from a database table is updated (1 is added to point) somewhat and the interface must still be looking the same.

The first choice is to use sql queries inside javascript like this link. But that is a bad practice and not recommended to use as security reason.

The second is to use server-side language in this case is PHP. I'm just new to Yii and PHP so could you tell me a way to achieve my goal.

Best regards.
Hung
0

#2 User is offline   mirunho 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 19-December 12
  • Location:Gdansk, Poland

Posted 19 February 2013 - 02:27 AM

You can use:
CHtml::ajaxSubmitButton('Save','your-url',array())


'your-url' is some action in controller
0

#3 User is offline   Trinh Duy Hung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 73
  • Joined: 26-October 12

Posted 19 February 2013 - 09:59 PM

View Postmirunho, on 19 February 2013 - 02:27 AM, said:

You can use:
CHtml::ajaxSubmitButton('Save','your-url',array())


'your-url' is some action in controller

Yes, it works. Thank you.
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