Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 31)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] Accessing database using Auto Actions Code

  • edb1
  • edb1
  • OFFLINE
  • Posts: 5
  • Thanks: 2
  • Karma: 0
11 years 3 months ago - 11 years 3 months ago #233474 by edb1
Hi All
Firstly, thank you for the whole CB development and the amazing support that you offer. The tutorials and webinars are a great help. Keep it up!

My problem:
I am trying to update database fields using the CODE type of auto action.
I have to create / update SOBIPRO entries. New Sobipro entries are created over a number of tables. The process I have tracked and understand so it shouldn't be difficult to create new entries. Updating existing ones is easier on a single table.

BUT
I have a problem using the CODE type of auto action. (Using QUERY I can easily perform single queries but as I have a number of queries to perform and different conditions depending on whether a user is creating a new entry or updating an entry it could get very clunky that way. )

The trigger works fine on QUERY.

But what am i doing wrong for the CODE type???
(All the queries all work when using QUERY)

For simplicity, here is a simple example that still doesn't work for me.

trigger onAfterUserUpdate
user AUTOMATIC
access ALL REGISTERED USERS
method PHP (eval)
return SILENT
Code:
$db = JFactory::getDbo(); $query ="INSERT INTO #_sobipro_field_data (fid,sid,baseData) VALUES (98,99,'hello')"; $db->setQuery($query);


THis query doesn't get processed.
Please point out the obvious to me.
Am I connecting to the database ok?

Many thanks
ED
Last edit: 11 years 3 months ago by edb1.

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

  • edb1
  • edb1
  • OFFLINE
  • Posts: 5
  • Thanks: 2
  • Karma: 0
11 years 3 months ago #233497 by edb1
Executing the query might help!

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

Moderators: beatnantkrileon
Powered by Kunena Forum