28-09-2010, 05:06 PM
Merci ça fonctionne impec.
Pour info j'ai corrigé comme ça :
Pour info j'ai corrigé comme ça :
<?php include 'define_bdd.php';
ob_start('ob_gzhandler');
$connect = mysql_connect(HOST,USER,PASS) or die('Erreur de connexion');
if (!mysql_select_db(BDD,$connect))return 0; if (!$connect)return 0;
$query = 'SELECT `user`,`rate`,`v`,`l`,`d` FROM furukoo ORDER BY rate DESC';
$result = mysql_query($query); mysql_close($connect); if (!$result)return 0;
while ($row = mysql_fetch_assoc($result)) {
// for every field in the result..
for ($i=0; $i < mysql_num_fields($result); $i++) {
$info = mysql_fetch_field($result, $i);
$type = $info->type;
// cast for int
if ($type == 'int')
$row[$info->name] = intval($row[$info->name]);
}
$rows[] = $row;
}
mysql_free_result($result);
echo json_encode($rows);
ob_end_flush();
?>