I had someone build out a custom CMS for a small site and now I can't get a hold of the developer. I get this error when trying to view my site:
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 'order by sortorder' at line 1:
select path, title
from pages
where parent_id =
order by sortorder
After some help I was able to I think pin point where the problem is:
public function getChildLinks()
{
$list = array();
$WHERE_path = substr($_SERVER['REQUEST_URI'], 1);
$WHERE_path = strlen($WHERE_path) ? '= "'.$WHERE_path.'"' : 'IS NULL';
$parentPageRowset = Axl_Db::query('SELECT id, parent_id FROM '.$this->_name.' WHERE path '.$WHERE_path);
$parent_id = $parentPageRowset[0]['parent_id'] ? $parentPageRowset[0]['parent_id'] : $parentPageRowset[0]['id'];
$listRowset = new Axl_Db_Rowset('SELECT path, title FROM '.$this->_name.' WHERE parent_id = '.$parent_id.' ORDER BY sortorder');
while($listRowset->next())
{
$list['/'.$listRowset->path] = $listRowset->title;
}
return $list;
}
This is the function causing the problem.
Well after getting great feed back from Adam I was able to really pin point what file I needed to fix and or look into a little deeper.
It turns out that I needed to quote out the parent_id variable
like so:
$listRowset = new Axl_Db_Rowset('select path, title from '.$this->_name.' where parent_id = "'.$parent_id.'" order by sortorder');
Thanks Adam for your help