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, no separation. 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
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 I F ($ _ GET ["move"] = "down ") {// Obtain the next news information $ query = $ conn-> query ("select * from 'article' where 'weight' <'$ _ GET [weight] 'Order by 'weight 'desclimit 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] '");} el Se {echo "script" alert ('bottom already '); script ";}}}?>
Move articles up and down
ID |
Title |
Mobile |
Query ("select * from 'article' order by 'weight' desc"); if ($ conn-> db_num_rows ($ query)> 0) {while ($ rows = $ conn-> fetch_array ($ query) {$ aid []. = $ rows ["ID"];?>
|
|
? Weight = & Move = up "> move up /? Weight = & Move = down "> move down |
Reply to discussion (solution)
This ...... The official CI documentation provides a complete example to show how to score points.
Read the document and find out how to get it.