RE: stumped by "order by"

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

 



--- Bastien Koert <bastien_k@xxxxxxxxxxx> wrote:

> Hi Stu
> 
> something like
> 
> Bif(!empty($s_Ind)) $aWHERE[] = "Jobs.Industry IN
> ($s_Ind)" ;
> if(!empty($s_State)) $aWHERE[] = "Jobs.State IN
> ($s_State)";
> if(!empty($s_TType)) $aWHERE[] = "Jobs.Term IN
> ($s_TType)";
> if(!empty($JTitle)) $aWHERE[] = "Jobs.Title LIKE
> '%$JTitle%'";
> if(!empty($City)) $aWHERE[] = "Jobs.City LIKE
> '%$City%'";
> if(!empty($Days)) $aWHERE[] = "Jobs.Post >=
> DATE_SUB(CurDate(), Interval ($Days) DAY)";
> 
> //the implode array statement to make the array into
> the where clause
> $query_rsVJ .= implode....
> 
> //then check if the sort element is passed
> if (isset($_GET['order_rsVJ'])) {
>   $orderParam_rsVJ = (get_magic_quotes_gpc()) ?
> $_GET['order_rsVJ'] :
> addslashes($_GET['order_rsVJ']);
> 
> $query_rsVJ.= " order by $orderParam_rsVJ ";
> 
Okay I wasn't sure but thought I might need to add
another query statement in.  So it would have made it
work except! , I found a new problem with this issue.

Hopefully I can clearly explain it.
There is a default $orderParam_rsVJ set up.  So when
the results are returned to the user things come back
sorted by the default column.

The problem is when I click the column sorter link and
the page re-loads, it looks like the where array is
getting wiped out, values are gone.  I get a "divison
by zero" error.  I'm assuming this is becasue the
order by statement is issued with no parameters.

Hope this makes sense and while I think it through
perhaps someone has an idea of remedy.

Stuart

-- 
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