I have changed the databse calls from "industries" to "modx_courses" so it can pull data from an exisitng table.
However I get the following error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Table ’emanz_modx.subindustries’ doesn’t exist »
SQL: SELECT i.*, COUNT(DISTINCT aoe.id) AS area_count FROM modx_courses i LEFT JOIN subindustries si ON si.industry_id = i.id GROUP BY i.id ORDER BY id DESC LIMIT 0, 25
This would appear related to the following section, which I do not understand. not sure what the line ""LEFT JOIN subindustries si ON si.industry_id = i.id " ." actualy does.
// execute the main table query with MakeTable sorting and paging features
$query= "SELECT i.*, COUNT(DISTINCT aoe.id) AS area_count " .
"FROM modx_courses i " .
"LEFT JOIN subindustries si ON si.industry_id = i.id " .
"GROUP BY i.id" . $objTable->handleSorting() . $objTable->handlePaging();
if ($ds= $this->db->query($query)) {
-
MODX Staff
- 10,725 Posts
Just remove that part of the query; this was just demonstrating a list of industries where each industry had a list of subindustries in another table. This query just provided a count of the number of subindustries that were related to each industry.
Looks like a very useful class. Do you have any more examples of how it is used? I’d really like to see how the different functions are used. Good job!
-
☆ A M B ☆
- 24,524 Posts
I’ll add my vote for this, would be great to see how it’s all put together in a heavy-duty, real-world situation. Even if you just add a blog post one step at a time!
That’ll be great to see. And, I’d be happy to help in anyway I can. hosting, setup, whatever. just let me know if i can.
Perhaps in the mean time tho you could help me out with a little problem i seem to be having. The links being created for the column headers for sorting are not working for me.
I’m getting results like this:
"index.php?id=10?orderby=id&orderdir=asc"
So, when i click on the links I get a parse error saying that << `10?orderby=id` is not numeric and may not be passed to makeURL() >>
The original link for the page was:
"index.php?id=10&patid=6"
... so i guess the sortby link should be something like:
"index.php?id=10&patid=6&orderby=id&orderdir=asc"
Any suggestions?
In quick it seems that this class would work only if FURLs are enabled.. But I might be wrong.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."