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>";?>
Elius93
  • 3
  • 2
  • 1
    `N° Asset con guasti` row probably does not exist in the database... – onionpsy Nov 13 '13 at 08:27
  • 'N° Asset con guasti row probably does not exist in the database...' all parameters are in the database.. – Elius93 Nov 13 '13 at 08:29
  • Can you show use your table ? "EXPORT TABLE ..." – Kevin Nov 13 '13 at 08:35
  • i'm not able to post table code, it say:It looks like your post is mostly code; please add some more details. and the 'export->table' option isn's available – Elius93 Nov 13 '13 at 08:55
  • Solved! the problem were slashs first and before () of 'QT \(Indisponibilità\)'. I took them off and now everything is working well. ty u all for help :) – Elius93 Nov 13 '13 at 10:48

1 Answers1

0

hm. might be a problem with encoding : try to add this after the $mysqli = new mysqli(DB_HOST, 'Elia', '1234', 'test'); :

$mysqli->set_charset("utf8")

if it doesn't work, juste don't use space or special char (like °) in your row name, it's a very poor practice.

and also, please print out the $row array :

print_r($row);
onionpsy
  • 1,502
  • 11
  • 15