Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-22-2010, 04:15 AM   PM User | #1
ajloun
Regular Coder

 
Join Date: Aug 2009
Posts: 215
Thanks: 74
Thanked 0 Times in 0 Posts
ajloun has a little shameless behaviour in the past
Move Recods Up and Down

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
ajloun is offline   Reply With Quote
Old 01-22-2010, 04:24 AM   PM User | #2
masterofollies
Senior Coder

 
Join Date: May 2005
Posts: 2,137
Thanks: 96
Thanked 72 Times in 72 Posts
masterofollies can only hope to improve
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.
__________________
Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?
masterofollies is offline   Reply With Quote
Old 01-22-2010, 05:23 AM   PM User | #3
ajloun
Regular Coder

 
Join Date: Aug 2009
Posts: 215
Thanks: 74
Thanked 0 Times in 0 Posts
ajloun has a little shameless behaviour in the past
Ok..

lets Say this is my Sql with Some Data.

PHP Code:
CREATE TABLE `test` (
  `
idint(4NOT NULL auto_increment,
  `
fruitvarchar(255NOT NULL default '',
  
PRIMARY KEY  (`id`)
ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=;



INSERT INTO `testVALUES (1'apple');
INSERT INTO `testVALUES (2'orange');
INSERT INTO `testVALUES (3'olive'); 
Now this the file to View the Data

PHP Code:
<?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 ..
ajloun is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:24 PM.


Advertisement
Log in to turn off these ads.