Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Enter SQL directly 4 years 11 months ago #3915

  • sackbut
  • sackbut's Avatar Topic Author
  • Offline
  • Posts: 32
  • Thank you received: 5
Here is something that I think would be really useful....

{joodb sql}Your SQL string here{/joodb}

I have a list of meetings which I can sort by meeting date. I'd like to show only those meetings still to come ie where their date is > today. I discovered that the template script will run PHP if you have Sorcerer installed as a Joomla plugin, so it is easy to build the WHERE clause.

But there is no way I can see to use "raw" SQL to return a recordset with joodb

(I know you can set a WHERE clause in the admin panel, but I'd like this to be automatic )

I'd pay for that

Please Log in or Create an account to join the conversation.

Enter SQL directly 4 years 11 months ago #3917

  • Dirk
  • Dirk's Avatar
  • Offline
  • Posts: 1168
  • Karma: 21
  • Thank you received: 218
It is much to dangerous to allow SQL conditions as search condition.

But there are another possibilities.
1: The searchfield option in JoodbPro.
{joodb searchfield|eventdate|min} would allow you to enter a minimum value for eventdate.
joodb.feenders.de/support/documentation.html?search=searchfield

2: The SQL - Where Parameter for the Catalog-Menu-Entry
Just enter something like
'eventdate' >= CURDATE()

And the catalog shows only entries with eventdate >= today!

Please Log in or Create an account to join the conversation.

Enter SQL directly 4 years 11 months ago #3919

  • sackbut
  • sackbut's Avatar Topic Author
  • Offline
  • Posts: 32
  • Thank you received: 5
That's what I want - excellent.

One further question - how can I implement the LIMIT clause ? For the front page of the site I just want only the NEXT event.

Thanks

After thinking about this I think it could done by setting the limit on the menu item to 1. Another menu item ( for the same table) for a different purpose could have a different limit. But can you insert the output of joodb directly into an article instead of onto its own page ?

Please Log in or Create an account to join the conversation.

Last edit: by sackbut. Reason: Afterthought

Enter SQL directly 4 years 11 months ago #3931

  • sackbut
  • sackbut's Avatar Topic Author
  • Offline
  • Posts: 32
  • Thank you received: 5
Another thought

It would be very useful to have the SQL LIMIT clause as pert of the {jooDB} syntax. With that, and the things you mention above, you have most of the simple SQL.

I know you can set a limit on the Menu, but it is clunky to have to set a new menu item whenever you want to change the limit parameter

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: Dirkjoest