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
codice:
SET @var='valore fisso'; select @var as myvar,......
se lancio la query direttamente su Mysql Funziona perfettamente
lanciata da php ricevo il seguente errore
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:\......
il mio file PHP cosi strutturato:
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);
cosa ha di sbagliato ??
Grazie 1000 ogni vostro consiglio sempre molto utile.