1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice
  2. If you update to Joomla 3.9.16, you will have to update Fabrik from the latest GitHub version, to fix a bug introduced in Joomla, which makes it impossible to list front end folder locations in backend JForms. This affects things like template selection.
    Dismiss Notice

What to do after I make changes in mysql database table

Discussion in 'Community' started by bontemuis, Mar 24, 2020.

  1. bontemuis

    bontemuis New Member

    Level: Community
    I have a list which is connected to a mysql database table. Suppose I want to add or delete columns in my table, what do I need to do in order to keep things in sync?
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    Add/delete (= trash, empty trash with checking "...drop (delete) the associated database column...") elements in Fabrik.
     
  3. bontemuis

    bontemuis New Member

    Level: Community
    Thanks troester. I just tested it and it works the way you describe!
     
  4. bontemuis

    bontemuis New Member

    Level: Community
    Because I cannot find the button for adding a new post anymore (please help)elp), I just continue with this post.
    I would like to achieve this:
    A have a form and I added a php plugin. At the "Start of Form Submission" I want to update a row in another table. I think something is wrong in the where clause, because if I directly point to a value for 'user_id', it does work. This is my code:

    $db = JFactory::getDbo();
    $user_id_now = (int) $formModel->getElementData('test___user_id');
    $query = $db->getQuery(true);
    $query->update('controlpanel')->set('veld1 = ' . $db->quote('1'))->where('user_id = ' . (int) $user_id_now);
    $db->setQuery($query);
    $db->execute();

    Can somebody explain what goes wrong here? I've already been testing with "$name = $formModel->formData['tablename___name'];" as well...
     
  5. troester

    troester Well-Known Member Staff Member

    Level: Community
    Var_dump is always good to see what you really get.
    You need the Joomla user id, probably you get the username (or whatever you have set your user_id element to display)
    Try
    $user_id_now = (int) '{test___user_id_raw}';
     
  6. bontemuis

    bontemuis New Member

    Level: Community
    Thanks again troester, that solved my problem! I will figure out how this var_dump thing works. Leaves me with one question for now: where can I find the forum button to add a new post?
     
  7. troester

    troester Well-Known Member Staff Member

    Level: Community
  8. bontemuis

    bontemuis New Member

    Level: Community
    Got it! Thanks!
     

Share This Page