1. Fabrik 3.7 is now available. This version contains critical security updates, please update as soon as possible. Please remember to backup your site before updating, we also recommend testing your updates on development sites if possible.
  2. We had to restore the site around midday (CST) on Wed 7/26 from a backup approximately 8 hours old. So a few posts in the forums were lost. You may want to check to see if you need to re-post anything.

Query on calc element

Discussion in 'Community' started by zucchetti, Sep 12, 2017.

  1. zucchetti

    zucchetti New Member

    Level: Supporter
    Hi, Im trying to display a user email on a list using a calc element, the email its on a direfrent table ( usersext_perfil), so I put the user id on a variable ($usuario) and make a left join to the other table to get the email. I tryed it on phpmyadmin and the query works.
    BUT it doesnt work on the calc field.
    Any help?

    $db = JFactory::getDBO();
    $usuario = '{reg_consultores_cv___usuario}');
    $query = "SELECT u.email FROM reg_consultores_cv AS r JOIN usersext_perfil AS u ON r.usuario=u.id_de_usuario WHERE u.id_de_usuario=".$usuario"";
    $db->setQuery( $query );
    $mail = $db->loadResult();
    return $mail;

    Attached Files:

  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    First, try appending _raw to the element name for the user ID. if that doesn't work, try debugging the query. Install jdump ...


    ... then on the line before the loadResult(), do ...

    dump($query, 'user query');

    Load you page, and you'll get a popup request from jdump.

    -- hugh

Share This Page