Create default sorting order.

Bug #707271 reported by TitanKing
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PHPDevShell
Fix Released
Medium
TitanKing

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

Changed in phpdevshell:
assignee: nobody → TitanKing (titan-phpdevshell)
importance: Undecided → Medium
Changed in phpdevshell:
status: New → Fix Committed
Changed in phpdevshell:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.