RE: [PHP-DB] Order DB through url toggle
| From: | Marco Tabini | Date: | Fri, 08 Nov 2002 16:28:35 +0000 |
| Subject: | RE: [PHP-DB] Order DB through url toggle | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-23149@lists.php.net to get a copy of this message | ||
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
>