1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.

Query on calc element

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

  1. zucchetti

    zucchetti Member

    Level: Community
    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?
    thanks!


    $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: Professional
    First, try appending _raw to the element name for the user ID. if that doesn't work, try debugging the query. Install jdump ...

    https://github.com/mathiasverraes/jdump#readme

    ... 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