Darkmatter5 Posted October 22, 2008 Share Posted October 22, 2008 Here's my code function show_filing() { include 'library/config.inc.php'; $conn=mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); mysql_select_db($dbnamemain); //$query=mysql_query("SELECT cab_name, fol_name, items.* // FROM items // JOIN folders ON(items.folder_id=folders.folder_id) // JOIN cabinets ON(cabinets.cabinet_id=folders.cabinet_id) // ORDER BY cabinets.cab_name DSC, folders.fol_name DSC // ") or die(mysql_error()); $query=mysql_query("SELECT cab_name, fol_name, items.* FROM items JOIN folders ON(items.folder_id=folders.folder_id) JOIN cabinets ON(cabinets.cabinet_id=folders.cabinet_id) ORDER BY cabinets.cab_name ASC, folders.fol_name ASC ") or die(mysql_error()); echo "<p> <table width='100%' border='0' cellspacing='1' cellpadding='3'> <th width='200'>PATH<img src='images/up.gif'><img src='images/down.gif'></th> <th width='200'>NAME<img src='images/up.gif'><img src='images/down.gif'></th> <th>DESCRIPTION</th> <th width='70'>ACTION</th>"; $filltog=0; while($row=mysql_fetch_array($query)) { if($filltog==0) { $fillcolor="#A8231C"; } else { $fillcolor="#686615"; } echo "<tr bgcolor='$fillcolor'> <td>$row[cab_name] -> $row[fol_name] -> </td> <td>" .substr($row['item_name'],0,100). "</td> <td>$row[item_description]</td> <td align='center'>Delete | Edit</td> </tr>"; if($filltog==0) { $filltog=1; } else { $filltog=0; } } echo "</table>"; mysql_close($conn); } This code is run from another page by this line. "<?php $ec->show_filing(); ?>" As you can see I have a descending and ascending version of the same query. I want the user to be able to click the up or down arrow gifs to resort and display the query result depending on what gif they click. Obviously up arrow meaning ascending and down arrow meaning descending. How can I make the script rerun depending on the arrow clicked? Link to comment https://forums.phpfreaks.com/topic/129593-rerun-code-from-a-image-hyperlink/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.