Let's see: <? $dir = ((isset ($_GET['dir'])) ? (int) $_GET['dir'] : 1); if (!$dir) $direction = 'desc'; $dir = ($dir ? 0 : 1); ?> <td><a href="default2.php?orderBy=<?=$colname?>&dir=<?= $dir?>">Last Name</a></td> This is the general idea. $dir will toggle between 1 and 0. There are more "compact" ways of writing this--but this one should be clearer. Marco ------------- php|architect -- The Monthly Magazine For PHP Professionals Come visit us on the web at http://www.phparch.com! On Fri, 2002-11-08 at 10:04, Paul Ihrig wrote: > Hello All! > i am new to the list & to PHP.. > > > So i have a recordset that displays my contacts in a table. > the headers of the columns look like this. > > <td><a href="default2.php?orderBy=priLastName">Last Name</a></td> > > so when a user clicks on it > It will Re-Sort the rs by priLastName Asc. > > what i want to do is make it a toggle > between table name ASC or DESC.. > > any ideas? > thanks. > > -paul > > #$orderBy = 'priFirstName'; > > $orderBy = 'priLastName'; > if (isset($HTTP_GET_VARS['orderBy'])) { > $orderBy = $HTTP_GET_VARS['orderBy']; > } > #?orderBy=priFirstName > > $maxRows_rsAll = 5;; > $pageNum_rsAll = 0; > if (isset($HTTP_GET_VARS['pageNum_rsAll'])) { > $pageNum_rsAll = $HTTP_GET_VARS['pageNum_rsAll']; > } > $startRow_rsAll = $pageNum_rsAll * $maxRows_rsAll; > > mysql_select_db($database_myFirstSql, $myFirstSql); > $query_rsAll = "SELECT * FROM userinfo ORDER BY $orderBy ASC"; > $query_limit_rsAll = sprintf("%s LIMIT %d, %d", $query_rsAll, > $startRow_rsAll, $maxRows_rsAll); > $rsAll = mysql_query($query_limit_rsAll, $myFirstSql) or die(mysql_error()); > $row_rsAll = mysql_fetch_assoc($rsAll); > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php