Jeg har gjort det før, jeg brugte MySQL database
Jeg lavede det så det så ca. sådan her ud i designet:
Admin     [V]
Gæst   [A][V] (Alle dem i midten har både pil op, og pil ned)
Bruger[A]
A = Pil op
Min kode ser sådan her ud:
-  print "Her kan du ændre menuen<br />";
-      
-      print "<table align='left'>";
-      
-      $last = mysql_query("SELECT position FROM site ORDER BY position DESC LIMIT 1");
-      $last2 = mysql_fetch_assoc($last);
-      
-      $first = mysql_query("SELECT position FROM site ORDER BY position ASC LIMIT 1");
-      $first2 = mysql_fetch_assoc($first);
-      
-      
-      
-      if($_GET['position'] != "" and $_GET['action'] == "op" or $_GET['action'] == "ned") {
-          
-                      if($_GET['action'] == "op") {
-                          $op = $_GET['position'] -1;
-                          $result = mysql_query("SELECT `id` FROM `site` WHERE position = '".$_GET['position']."'");
-                          $result1 = mysql_query("SELECT `id` FROM `site` WHERE position = '".$op."'");
-                              $resulta = mysql_fetch_assoc($result);
-                              $resultb = mysql_fetch_assoc($result1);
-                              
-                                  mysql_query("UPDATE site SET position = '".$op."' WHERE id = '".$resulta['id']."'");
-                                  mysql_query("UPDATE site SET position = '".$_GET['position']."' WHERE id = '".$resultb['id']."'");
-                              
-                      }
-                      elseif($_GET['action'] == "ned") {
-                          $ned = $_GET['position'] +1;
-                          $result = mysql_query("SELECT `id` FROM `site` WHERE position = '".$_GET['position']."'");
-                          $result1 = mysql_query("SELECT `id` FROM `site` WHERE position = '".$ned."'");
-                              $resulta = mysql_fetch_assoc($result); // Denne skal ændres til $resultb
-                              $resultb = mysql_fetch_assoc($result1); // Denne skal ændres til $resulta
-                              
-                                  mysql_query("UPDATE site SET position = '".$ned."' WHERE id = '".$resulta['id']."'"); 
-                                  mysql_query("UPDATE site SET position = '".$_GET['position']."' WHERE id = '".$resultb['id']."'");
-                                  
-                      }
-      }
-      
-      $result = mysql_query("SELECT `id`,`name`, `position` FROM `site` ORDER BY position ASC");
-  
-                  if (!$result) print "Der er sket en fejl";
-  
-                  while ($row = mysql_fetch_assoc($result)) {
-                      if($row['position'] == "1"){
-                              $down = $row['position']+1;
-                              print('
-                                  <tr>
-                                      <td>
-                                          '.$row['name'].'
-                                      </td>
-                                      <td>
-                                      </td>
-                                      <td>
-                                          <a href="?side=editmenu&position='.$row['position'].'&action=ned">
-                                              <img src="images/down.gif" border="0">
-                                          </a>
-                                      </td>
-                                  </tr>');    
-                          }
-                      elseif($row['position'] != "1" and $row['position'] != $last2['position']){
-                              print('
-                                  <tr>
-                                      <td>
-                                          '.$row['name'].'
-                                      </td>
-                                      <td>
-                                          <a href="?side=editmenu&position='.$row['position'].'&action=op">
-                                              <img src="images/up.gif" border="0">
-                                          </a>
-                                      </td>
-                                      <td>
-                                          <a href="?side=editmenu&position='.$row['position'].'&action=ned">
-                                              <img src="images/down.gif" border="0">
-                                          </a>
-                                      </td>
-                                  </tr>');
-                          }
-                      elseif($row['position'] == $last2['position']){
-                              print('
-                                  <tr>
-                                      <td>
-                                          '.$row['name'].'
-                                      </td>
-                                      <td>
-                                          <a href="?side=editmenu&position='.$row['position'].'&action=op">
-                                              <img src="images/up.gif" border="0">
-                                          </a>
-                                      </td>
-                                      <td>
-                                      </td>
-                                  </tr>');
-                          }
-                      
-                  }
-                  
-                  print "</table>";
Og det virkede for mig.
						
						
						
						
		
							Indlæg senest redigeret d. 17.04.2012 13:26 af Bruger #7056