← Back to team overview

phpdevshell team mailing list archive

[Bug 707271] Re: Create default sorting order.

 

** Changed in: phpdevshell
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of
PHPDevShell, which is subscribed to PHPDevShell.
https://bugs.launchpad.net/bugs/707271

Title:
  Create default sorting order.

Status in Open Source PHP RAD Framework with UI.:
  Fix Committed

Bug description:
  My query looks like this:
      protected $sql = "
          SELECT *
          FROM _db_ya%u_offerings
          ORDER BY date
      ";
      protected $keyField=false;

  Now when I display the $pagination->searchForm() in the template, it
  displays ok, when I type something in it and hit enter, I get the
  following error listed below.

  I think it is because I included the ORDER BY in my original SQL and
  it is then trying to add the WHERE clause afterwards which does not
  work. What is the proper way to the ORDER BY clause?

  Thanks

  ERROR:
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id LIKE '%hi%' OR unique_id LIKE '%hi%' OR date LIKE '%hi%' OR lo' at line 6
  The MySQL database engine returned with an error (code 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id LIKE '%hi%' OR unique_id LIKE '%hi%' OR date LIKE '%hi%' OR lo' at line 6

  The faulty query REAL SQL was:
          SELECT SQL_CALC_FOUND_ROWS *
          FROM _db_ya1_offerings
          ORDER BY date
   WHERE  
   id LIKE '%hi%' OR 
   unique_id LIKE '%hi%' OR 
   date LIKE '%hi%' OR 
   location_id LIKE '%hi%' OR 
   state_province_id LIKE '%hi%' OR 
   country_id LIKE '%hi%' OR 
   currency_id LIKE '%hi%' OR 
   cash LIKE '%hi%' OR 
   other LIKE '%hi%' OR 
   other_no LIKE '%hi%' OR 
   foreign_cash LIKE '%hi%' OR 
   foreign_other LIKE '%hi%' OR 
   foreign_no LIKE '%hi%' 
   LIMIT 0, 30





References