After separating html pages based on the CI framework, I found a shift function on the Internet, but the code is php, mysql, and html mashups. now I am using the CI framework. I just got started with the framework, will not be separated, please help to separate this page according to the CI framework mode database page: class_moder.php processing page: adm seeking to separate the html page according to the CI framework
I found a shift-by-order function on the Internet, but the code is php, mysql, and html mashups. now I am using the CI framework and will not be separated shortly after I first came into contact with the framework, please help separate this page according to the CI framework mode
Database page: class_moder.php
Processing page: admin. php
Html page: sort.html
News is moved up and down
Header ("Content-type: text/html; charset = gb2312 ");
Include ("mysql. class. php ");
$ Conn = new mysql ("localhost", "root", "root", "test", "", "gbk ");
If (! Emptyempty ($ _ GET ["weight"]) {
If ($ _ GET ["move"] = "up "){
// Obtain the previous news information
$ Query = $ conn-> query ("select * from 'article' where 'weight'> '$ _ GET [weight] 'Order by 'weight' asc limit 1 ");
If ($ conn-> db_num_rows (query)> 0 ){
$ Rows = $ conn-> fetch_array ($ query );
$ Conn-> query ("update 'article' set 'weight' = '$ rows [weight] 'Where 'weight' =' $ _ GET [weight] '");
$ Conn-> query ("update 'article' set 'weight' = '$ _ GET [weight] 'Where 'id' =' $ rows [ID] '");
} Else {
Echo "script" alert ('already at the top '); script ";
}
} Else if ($ _ GET ["move"] = "down "){
// Obtain the next news
$ Query = $ conn-> query ("select * from 'article' where 'weight' <'$ _ GET [weight] 'Order by 'weight' desc limit 1 ");
If ($ conn-> db_num_rows (query)> 0 ){
$ Rows = $ conn-> fetch_array ($ query );
$ Conn-> query ("update 'article' set 'weight' = '$ rows [weight] 'Where 'weight' =' $ _ GET [weight] '");
$ Conn-> query ("update 'article' set 'weight' = '$ _ GET [weight] 'Where 'id' =' $ rows [ID] '");
} Else {
Echo "script" alert ('bottom already '); script ";
}
}
}
?>
Move articles up and down
IDTitleMobile