...

View Full Version : Move Recods Up and Down



ajloun
01-22-2010, 05:15 AM
Hello

Is it possible to change order eg

1: oranges
2: apples
3: lemon
4: grapes

I want to then, say move record 3:lemons up to replace 4:apples

so new order

1: oranges
3: lemon
2: apples
4: grapes

Basically move the order of any record up or down , by two icons One Up One down .?

Please See Image
http://img16.imageshack.us/img16/7159/orderw.png (http://img16.imageshack.us/i/orderw.png/)

masterofollies
01-22-2010, 05:24 AM
You didn't give any information on the placement of this. Is it like that in the database? is it plain text coded in a file?

Need to know how you have it before we can decide the best way of helping you.

ajloun
01-22-2010, 06:23 AM
Ok..

lets Say this is my Sql with Some Data.


CREATE TABLE `test` (
`id` int(4) NOT NULL auto_increment,
`fruit` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;



INSERT INTO `test` VALUES (1, 'apple');
INSERT INTO `test` VALUES (2, 'orange');
INSERT INTO `test` VALUES (3, 'olive');


Now this the file to View the Data


<?php
// Connects to your Database
mysql_connect("localhost", "root", "pass") or die(mysql_error()) ;
mysql_select_db("test") or die(mysql_error()) ;



$data = mysql_query("SELECT * FROM test ") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data ))
{


Echo "<b>Name:</b> ".$info['fruit'] . "<br> ";

}

?>

this will print all

as
apple
orange
olive

i need to have icon next to each one to move the type up or down (sort) like make the olive the top and the orange the last

olive
apple
orange

that is just example , not the actual Code , But if i get the idea in how i can try apply it to my live code ..



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum