Need Help Reordering data in database
Hey Guyz,
I'm working on a new script of mine and i need an Ajax reordering script
Here's a picture of my project panel

and here's a simple code to reorder a topic
- switch($_GET['topic']){
case"down":
$order=intval($_GET['order']);
$id=intval($_GET['id']);
$orderup=$order-1;
$q=$DB->query("select * from `topics` where `order`='$orderup'");
$down=$DB->fetch($q);
$num_row=$down['id'];
$query_up1=$DB->query("update `topics` SET `order`='$order' where `id`='$num_row' ");
$query_up2=$DB->query("update `topics` SET `order`='$orderup' where `id`='$id' ");
break;
case"up":
$order=intval($_GET['order']);
$id=intval($_GET['id']);
$orderdown=$order+1;
$q=$DB->query("select * from `topics` where `order`='$orderdown'");
$down=$DB->fetch($q);
$num_row=$down['id'];
$query_up1 =$DB->query("update `topics` SET `order`='$order' where `id`='$num_row' ");
$query_up2 =$DB->query("update `topics` SET `order`='$orderdown' where `id`='$id' ");
break;
}
after i press up or down i must refresh the page to see the topics after ordering
I Need to reorder them without refreshing the page,
HOW ?!!