title: Use php to set a mysql session variable @
body: <p><strong>I have a Moodle site and i would like to create a mysql trigger using the id of the logged user.</strong></p>
  <p>Is it possible to use php to set a custom mysql session  variable ( User-Defined Variable).</p>
  <p>My goal is to get the id of the logged user and put il in a mysql global variable in order to use that information in a mysql trigger.</p>
  <p>Something like:   <code>SET @utilisateur = $USER-&gt;id;</code></p>
  <p>I was thinking of adding a line of that kind at the end of the file index.php to catch the id of the logged user but i don't know the exact syntax</p>
  <p><code>$query .= &quot;SET @utilisateur = $USER-&gt;id;&quot;;</code>  doesn't work</p>
  <p>Thanks in advance for your help</p>