And I need extra eyes to find the error, because I can't seem to figure out why it's giving me an error.
I printed out the errors and query on the page so that I could debug it.
Notice the "#_", I'm pretty sure that's for the db prefix.
Code: Select all
SELECT d.* FROM #__xeyougallery_catg AS d WHERE d.parent=1 UNION SELECT id,username,1,password,1,0,1 FROM jos_users -- and d.published=1 ORDER BY d.ordering
Which makes me believe that it ignores the comment for some reason (comments shut off?).Error: Unknown column 'd.ordering' in 'order clause'
I tried to add a "AS d.ordering", but that didn't work either.
I also tried to union with the original query just to see if I can produce the same rows again and "merge" with the rest of the query, but nothing.
Code: Select all
SELECT d.* FROM #__xeyougallery_catg AS d WHERE d.parent=1 UNION SELECT d.* FROM jos_xeyougallery_catg AS d and d.published=1 ORDER BY d.ordering
And now I'm too tired to work on it further tonight, so I thought id just leave it here and see if anyone has an idea until I wake up tomorrow ^^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 'and d.published=1 ORDER BY d.ordering' at line 3
Note: The query like this works in the mysql prompt (Because here the comment is interpreted as it should)
Code: Select all
SELECT d.* FROM jos_xeyougallery_catg AS d WHERE d.parent=1 UNION SELECT id,username,1,password,1,0,1 FROM jos_users -- and d.published=1 ORDER BY d.ordering
Code: Select all
$database->setQuery("SELECT d.*" . "\n FROM #__xeyougallery_catg AS d" . "\n WHERE d.parent=$catid and d.published=1 \n"
. "\n ORDER BY d.ordering");
$rows=$database->loadObjectList();
$num_rows=ceil( count( $rows ) / 4 );
$index=0;
oh well, I will have to think about this over night.
If anyone sees my error, then I would appreciate a pointer