PHP interesse |
|
ik probeer met een link te sorteren..
ik ben het script aan het bewerken.. misschien dat iemand kan zien wat er fout gaat?
echo ("<a href=\"index.php?option=com_a6mambohelpdesk&sorteerop=username\">Sorteer op naam</a>");
echo ("<a href=\"index.php?option=com_a6mambohelpdesk&sorteerop=id\">Sorteer op leeftijd</a>");
echo ("<a href=\"index.php?option=com_a6mambohelpdesk&sorteerop=level\">Sorteer op aantal posts</a>");
mysql_query("SELECT * FROM mos_helpdesk_tickets ORDER BY ".$_GET["sorteerop"]." DESC");
echo ("<a href=\"index.php?option=com_a6mambohelpdesk&sorteerop=username\">Sorteer op naam</a>"); echo ("<a href=\"index.php?option=com_a6mambohelpdesk&sorteerop=id\">Sorteer op leeftijd</a>"); echo ("<a href=\"index.php?option=com_a6mambohelpdesk&sorteerop=level\">Sorteer op aantal posts</a>"); mysql_query("SELECT * FROM mos_helpdesk_tickets ORDER BY ".$_GET["sorteerop"]." DESC");
Hier geef ik aan wat hij moet sorteren..
en dit is wat gesorteerd moet worden.
echo( "<table width='100%' border='0'cellpadding='0' cellspacing='0' class='moduletable'>" );
echo( "<th valign='top' colspan='7'>" . TICKETS_TITLE . "</th>" );
echo("<tr><td> </td><td>#</td><td><b>" . TICKETS_INDATE . "</b></td><td><b>" . TICKETS_CAPTION . "</b></td><td><b>" . TICKETS_CATEGORY . "</b></td><td><b>" . TICKETS_LEVEL . "</b></td><td><b>" . TICKETS_STATUS . "</b></td><td><b>" . TICKETS_USERNAME . "</b></td><td><b>" . TICKETS_FROM . "</b></td></tr>");
$i = 0;
foreach( $tickets as $ticket )
{
$status = getStatus( $ticket->status );
$level = getLevel( $ticket->level );
$indate = mysql_datetime_to_human($ticket->indate);
$catname = getCategory($ticket->catid);
$username = getCategory($ticket->username);
$from = getAuthor( $ticket->userid );
$i = $i + 1;
if ($i % 2) {
echo("<tr bgcolor='$table_bgcolor_even'>");
} else {
echo("<tr bgcolor='$table_bgcolor_odd'>");
}
echo( "<td><a href='$baseurl&cmd=TIC&ticketid=$ticket->id'><img src='images/M_images/edit.png'border='0'></a></td><td>$ticket->id</td><td>$indate</td><td>$ticket->title</td><td>$catname</td><td>$level</td><td>$status</td><td>$ticket->username</td><td>$from</td>" );
echo ("</tr>");
}
echo( "</table>" );
}
echo( "<table width='100%' border='0'cellpadding='0' cellspacing='0' class='moduletable'>" ); echo( "<th valign='top' colspan='7'>" . TICKETS_TITLE . "</th>" ); echo("<tr><td> </td><td>#</td><td><b>" . TICKETS_INDATE . "</b></td><td><b>" . TICKETS_CAPTION . "</b></td><td><b>" . TICKETS_CATEGORY . "</b></td><td><b>" . TICKETS_LEVEL . "</b></td><td><b>" . TICKETS_STATUS . "</b></td><td><b>" . TICKETS_USERNAME . "</b></td><td><b>" . TICKETS_FROM . "</b></td></tr>"); $i = 0; foreach( $tickets as $ticket ) { $status = getStatus( $ticket->status ); $level = getLevel( $ticket->level ); $indate = mysql_datetime_to_human($ticket->indate); $catname = getCategory($ticket->catid); $username = getCategory($ticket->username); $from = getAuthor( $ticket->userid ); $i = $i + 1; if ($i % 2) { echo("<tr bgcolor='$table_bgcolor_even'>"); } else { echo("<tr bgcolor='$table_bgcolor_odd'>"); } echo( "<td><a href='$baseurl&cmd=TIC&ticketid=$ticket->id'><img src='images/M_images/edit.png'border='0'></a></td><td>$ticket->id</td><td>$indate</td><td>$ticket->title</td><td>$catname</td><td>$level</td><td>$status</td><td>$ticket->username</td><td>$from</td>" ); } }
Allemaal niet zo heel gemakkelijk al zeg ik het zelf...
|