0

i'm having a problem with my php code: browser show me this error: ERRNO: 8|TEXT:Undefined index:N° Asset con guasti i'm trying to do dinamic table taking data from a database, but something with the 'fetch_array(MYSQLI_ASSOC)' function must have gone wrong

<?php 
require_once('FirePHPCore/FirePHP.class.php');
require_once('error_handler.php');
require_once('config.php');
$firephp = FirePHP::getInstance(true);

$mysqli = new mysqli(DB_HOST, 'Elia', '1234', 'test');

//query SQL da eseguire
$query = 'SELECT * FROM `livello_di_servizio`';     

//esegue la query
$result = $mysqli->query($query);
.
.
.
.
.
.
while ($row = $result->fetch_array(MYSQLI_ASSOC)){
//errore (undefined index)
echo "<tr><td class='tab_sx' style='text-align: left'>".$row['Etichette di riga']."</td>";
echo "<td class='gruppo' style='text-align: center'>".$row['Numero Macchine']."</td>";
echo "<td class='gruppo' style='text-align: right'>".$row['Ore Pianificate Mese']."</td>";
echo "<td class='gruppo' style='text-align: center'>".$row['N° Asset con guasti']."</td>";
echo "<td class='gruppo' style='text-align: right'>".$row['DT Periodo']."</td>";
echo "<td class='tab_guasti_top' style='text-align: center'>".$row['N° Guasti Totali']."</td>";
echo "<td bgcolor='#FFF' class='tab_dx' style='text-align: right'>".$row['QT \(Indisponibilità\)']."</td></tr>";
}
echo "</table></div></div>";?>
4

1 回答 1

0

嗯。可能是编码问题:尝试在之后添加$mysqli = new mysqli(DB_HOST, 'Elia', '1234', 'test');

$mysqli->set_charset("utf8")

如果它不起作用,请不要°在行名中使用空格或特殊字符(如 ),这是一种非常糟糕的做法。

另外,请打印出$row数组:

print_r($row);
于 2013-11-13T08:37:52.100 回答