salve a tutti
devo ottenere un risultato uguale:
Codice PHP:
echo json_encode(array(
array(
'id' => 1,
'title' => "Event1",
'start' => "$year-$month-10",
'url' => "http://yahoo.com/"
),
array(
'id' => 2,
'title' => "Event2",
'start' => "$year-$month-20",
'end' => "$year-$month-22",
'url' => "http://yahoo.com/"
)
));
con i dati del mio database.
Ho fatto così, ma mi contina a dare errore sull'array:
Parse error: syntax error, unexpected T_WHILE, expecting ')'
Codice PHP:
session_start();
include("include/config.php");
$s_evento="SELECT * FROM $table WHERE id IN (SELECT id_evento FROM table9 WHERE user='$_COOKIE[utente]')";
$r_evento=mysql_query($s_evento);
$tot_evento=mysql_num_rows($r_evento);
if(!$i){ $i="1"; }
echo json_encode(array(
while($d_evento=mysql_fetch_array($r_evento))
{
array(
'id' => $i,
'title' => $d_evento['titolo'],
'start' => $d_evento['data_inizio'],
'end' => $d_evento['data_fine'],
'url' => "evento.php?id=".$d_evento['id']
) if($tot_evento!=$i) echo ",";
$i++;
}
));