Set a mysql variable with Php

Set a mysql variable with Php

by Yvan Leduc -
Number of replies: 0

Is it possible to use php to set a custom mysql session  variable ( User-Defined Variable).

 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.

Something like:   SET @utilisateur = $USER->id;

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

 $query .= "SET @utilisateur = $USER->id;";  doesn't work

Thanks in advance for your help

Average of ratings: -