Ciao a tutti ragazzi.
Ho il seguente problema con una select.
Premesso che la select funzionava prima di aggiungere la mia variabile ed ora mi trovo ad aver aggiunto
se lancio la query direttamente su Mysql Funziona perfettamentecodice:SET @var='valore fisso'; select @var as myvar,......
lanciata da php ricevo il seguente errore
il mio file PHP cosi strutturato:codice:Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\ream\php\fetch.php:36 Stack trace: #0 C:\xampp\htdocs\ream\php\fetch-resources.php(36): mysqli_fetch_assoc(false) #1 {main} thrown in C:\......
cosa ha di sbagliato ??codice:include "db_connect.php"; $connect = OpenCon(); $json = array();$sqlQuery = "SET @var='valore fisso'; select @var as myvar, mytable.id from mytable"; $result = mysqli_query($connect, $sqlQuery);$eventArray = array(); while ($row = mysqli_fetch_assoc($result)) { array_push($eventArray, $row); } mysqli_free_result($result); mysqli_close($connect); echojson_encode($eventArray);
Grazie 1000 ogni vostro consiglio sempre molto utile.

Rispondi quotando