Simple additions and deletions check skeleton

Source: Internet
Author: User

Home Display

<! DOCTYPE html>ul{List-style-type:None;margin: 0;p Adding: 0; overflow:hidden;} li{float:Left ;} A: Link,a:Visited{display:Block;width:120px;font-weight:Bold;color:#FFFFFF;Background-color:#Bebebe;Text-align:center;padding:4px;text-decoration:None;text-transform:uppercase;} A: Hover,a:Active{background-color:#cc0000;}</style>foreachName= "div" item= "vo" ><div style=border-style:outset>User: {$vo.Username}</div><br> </foreach></body>

Add page

<! DOCTYPE html>ul{List-style-type:None;margin: 0;p Adding: 0; overflow:hidden;} li{float:Left ;} A: Link,a:Visited{display:Block;width:120px;font-weight:Bold;color:#FFFFFF;Background-color:#Bebebe;Text-align:center;padding:4px;text-decoration:None;text-transform:uppercase;} A: Hover,a:Active{background-color:#cc0000;}</style>User name: <input type= "text" name= "name" ><br><br>Password: <input type= "text" name= "password" ><br><br><input type= "Submit" ></form></body >

Delete Page

<! DOCTYPE html>ul{List-style-type:None;margin: 0;p Adding: 0; overflow:hidden;} li{float:Left ;} A: Link,a:Visited{display:Block;width:120px;font-weight:Bold;color:#FFFFFF;Background-color:#Bebebe;Text-align:center;padding:4px;text-decoration:None;text-transform:uppercase;} A: Hover,a:Active{background-color:#cc0000;}</style>foreachName= "div" item= "vo" ><div style=border-style:outset>User: {$vo. Username} <a href= "{: U (' Index/deldel ', Array (' username ' =$vo[' username '])} " > Delete this item </a></div><br> </foreach></body>

Controller

<?PHP//This class is automatically generated by the system and is intended for testing purposes onlyclassIndexactionextendsAction {//Show Users     Public functionindex () {Header("content-type:text/html; Charset=utf-8 ");$User= M ("user");//instantiating a model class $data=$User-Select ();$this->assign (' div ',$data); $this-display (); }  Public functionAdd () {$this->display (' Tpl/add '); } Public functionAddadd () {$data["username"] =$_post[' Name '];//Receive user name$data["Encryptedpassword"] = I (' Password ', ' ', ' MD5 '));$data["CreationDate"]= Time();$data["Modificationdate"]= Time();$User= M (' user ');$User->add ($data);$t= Time();//$User = D ("user"), if ($vo = $User->create ()) {//if ($User->add ()) {//$this->success (' Add user Success ');//}else{//$ This->error (' Add user failed ');//}//}else{//$this->error ($User->geterror ());/}Echo' Now: '.Date(' y-m-d '). " \ n ";d UMP ($data);$this->redirect (' Index/add '); }     Public functiondel () {Header("content-type:text/html; Charset=utf-8 ");$User= M ("user");//instantiating a model class $data=$User-Select ();$this->assign (' div ',$data); $this->display (' Tpl/del '); }     Public functionDeldel () {$username= I (' username ');//Receive ID$del= M (' user ');$del->where ("username = '$username' ")Delete ();//Echo ' Delete succeeded! ';Dump$username);d UMP ($del);$this->redirect (' Index/del '); }}

The setting device

<?PHPreturn Array(    //' Config item ' = ' config value '//' USERNAME ' + ' admin ',//assignment//database configuration information' Db_type ' = ' mysql ',//Database Type' db_host ' = ' localhost ',//Server Address' Db_name ' = ' openfire ',//Database name' Db_user ' = ' root ',//User name' Db_pwd ' = ' root ',//Password' Db_port ' = 3306,//Port' Db_prefix ' = ' of ',//database table prefix//other project configuration Parameters//...);?>

Simple additions and deletions check skeleton

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.