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