Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2009
    Posts
    215
    Thanks
    74
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    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?

  • #3
    Regular Coder
    Join Date
    Aug 2009
    Posts
    215
    Thanks
    74
    Thanked 0 Times in 0 Posts
    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 ..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •