orderBy Search Results
15 posts by 3 authors in: Forums > CMS Builder
Last Post: May 8, 2013 (RSS)
By s2smedia - May 8, 2013
now i get this error:
Search Multiple Tables: MySQL 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 '10 OFFSET 0' at line 5
<?php
require_once "../../admin/lib/viewer_functions.php";
$searchOptions = array();
$searchOptions['keywords'] = @$FORM['q'];
$searchOptions['perPage'] = "10";
$searchOptions['orderBy'] = "item";
$searchOptions['debugSql'] = "0";
$searchTables = array();
$searchTables['products'] = array(
'viewerUrl' => 'productdetails.php',
'titleField' => 'item',
'summaryField' => 'item_description',
'field1' => 'pattern',
'field2' => 'size',
'searchFields' => array('item','item_description','pattern'),
);
list($searchRows, $searchDetails) = searchMultipleTables($searchTables, $searchOptions);
?>
By Jason - May 8, 2013
Hi,
Could you set debugSql to 1 and then post the output?
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By s2smedia - May 8, 2013
SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT 'products' as `tablename`, num, `item` as `_title`, `item_description` as `_summary`, `pattern` as `field1`, `size` as `field2`, '' as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `item`, `item_description`, `pattern`) as _content FROM `cms_products` ) as combinedTable WHERE (`_content` LIKE '%55%') ORDER BY itemLIMIT 10 OFFSET 0
By Jason - May 8, 2013
Hi,
Okay, it looks like there's a small bug in the script that produces the query when using orderBy. To get around this issue, try putting a space after "item" like this;
$searchOptions['orderBy'] = "item ";
Let me know if that works for you.
Thanks!
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By s2smedia - May 8, 2013
getting there...
now get this:
SELECT SQL_CALC_FOUND_ROWS * FROM ( SELECT 'products' as `tablename`, num, `item` as `_title`, `item_description` as `_summary`, `pattern` as `field1`, `size` as `field2`, '' as `field3`, '' as `field4`, '' as `field5`, '' as `field6`, '' as `field7`, '' as `field8`, '' as `field9`, '' as `field10`, CONCAT_WS('\t', `item`, `item_description`, `pattern`) as _content FROM `cms_products` ) as combinedTable WHERE (`_content` LIKE '%55%') ORDER BY item LIMIT 10 OFFSET 0
Search Multiple Tables: MySQL Error: Unknown column 'item' in 'order clause'