RE: Order DB through url toggle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think you might be missing a = sign in your if statement.


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 11:26, Paul Ihrig wrote:
> well i tried that..
> 
> but it out puts the right number.
> but it is not taking that var to switch ACS or DESC...
> 
> http://localhost/php/default2.php?orderBy=priLastName&dir=0
> http://localhost/php/default2.php?orderBy=priLastName&dir=1
> 
> /* here we set up out order by clause */
> $orderBy = 'priLastName';
> if (isset($HTTP_GET_VARS['orderBy'])) {
>   $orderBy = $HTTP_GET_VARS['orderBy'];
> }
> /* and the desc asc */
> if $HTTP_GET_VARS['dir'] = 0 {
>   $diri = 'DESC';
>   } else {
>   $diri = 'ASC';
>   }
> 
> mysql_select_db($database_myFirstSql, $myFirstSql);
> $query_rsAll = "SELECT * FROM userinfo ORDER BY $orderBy $diri";
> $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);
> 
> Then
> 
> <?
> 
> $dir = ((isset ($_GET['dir'])) ? (int) $_GET['dir'] : 1);
> 
> if (!$dir)
> 	$direction = 'desc';
> 
> $dir = ($dir ? 0 : 1);
> 
> ?>
> 
> 
> <td><a href="default2.php?orderBy=priLastName&dir=<?= $dir?>">Last
> Name</a></td>
> <td><a href="default2.php?orderBy=priPhone">Phone</a></td>
> <td><a href="default2.php?orderBy=priEmail">Email</a></td>
> <td><a href="default2.php?orderBy=priStreet">Street</a></td>
> <td><a href="default2.php?orderBy=priCity">City</a></td>
> 
> 
> -- 
> 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux