ThinkPHP3.2.3

Source: Internet
Author: User
ThinkPHP3.2.3 question: I recently learned thinkphp3.2.3. I am going to do my graduation design. now I am stuck in a problem.
This module can add data that cannot be modified or deleted. Hope you can save it.
I wonder if there is a problem with the input parameters.
Data table
Create table if not exists 'item' ('number' smallint (3) unsigned zerofill not null AUTO_INCREMENT COMMENT 'Project number', 'iname' varchar (64) character set latin1 not null comment 'Project name', 'quantity 'smallint (2) DEFAULT '1' comment' contestant (> 1 indicates a group project )', 'proportion 'smallint (6) not null comment' participating scale ', primary key ('number'), unique key 'itemnumber' ('number ')) ENGINE = MyISAM default charset = utf8 COMMENT = 'project' AUTO_INCREMENT = 6;


Controller
Public function update ($ inumber) {// The Add form if (! IS_POST) {$ model = M ('ITEM')-> where ('inumber = '. $ inumber)-> find (); $ this-> assign ('item', $ model); $ this-> display ();} if (IS_POST) {$ model = D ("item"); if (! $ Model-> create () {$ this-> error ($ model-> getError ();} else {if ($ model-> save ()) {$ this-> success ("updated successfully", U ('item/index '));} else {$ this-> error ("update failed ");}}}}


    
     


Reply to discussion (solution)

The where condition is missing for 14 rows in the controller.

If ($ model-> where ('inumber = '. I ('inumber')-> save ()! = False) {$ this-> success ('modified successfully');} else {$ this-> error ('modification failed! ')}

If ($ model-> where ('inumber = '. I ('inumber')-> save ()! = False) {$ this-> success ('modified successfully');} else {$ this-> error ('modification failed! ')}


I can't change it to I ('post. inumber ').

Forgot to paste the entry

 
                             {$ V. inumber}                {$ V. iname}                {$ V. quantity}                {$ V. proportion}                Edit | delete                    
 

Solved !!! Entry route error

                Edit | delete

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.