현재 MySQL을 사용하는 PHP 파일이 있는데 00:00에서 23:00 (결과는 시간표입니다)의 결과가 반환되지만, 01 : 00 23 : 00 :PHP에서 MySQL 쿼리가 true 결과를 반환하지 않습니다.
<?PHP
include("../panel/config.php");
#// Timetable Clearup Variabls
$yesterday = strtotime('yesterday');
$yesterdow = date('l',$yesterday);
$order = "SELECT * FROM timetable WHERE day = '$yesterdow' ORDER BY time LIMIT 0 , 30";
$result = mysql_query($order);
$yesterdayd = date('F jS, Y', time()-86400);
//SET XML HEADER
header('Content-type: text/xml');
//CONSTRUCT RSS FEED HEADERS
$output = '<rss version="2.0">';
$output .= '<channel>';
$output .= "<title>Timetable - {$yesterdayd} </title>";
$output .= '<description>Timetable.</description>';
$output .= '<link>http://www.site.com</link>';
while ($row = mysql_fetch_array($result)) {
//BODY OF RSS FEED
$output .= "<item><title>Timetable - {$yesterdayd}</title>
<description>";
while ($row=mysql_fetch_array($result))
{
$rowset[] = $row;
//BODY OF RSS FEED
$output .= htmlspecialchars($row['time']) . " " . htmlspecialchars($row['username']) . "<br/>";
}
$output .= '</description></item> ';
}
//CLOSE RSS FEED
$output .= '</channel>';
$output .= '</rss>';
//SEND COMPLETE RSS FEED TO BROWSER
$filename = "timetable.xml";
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $output) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
if (fwrite($handle, $total) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote {$content}{$total} to file ($filename)";
fclose($handle);
?>
사람이 때문에 루프 동안 두 번에 당신은 첫 번째 결과를 덮어 일부 빛
이 숙제가 있습니까? 누군가 비슷한 것을 올렸습니다 ... http://stackoverflow.com/questions/10111956/display-results-from-mysql-query-into-table-using-php/10112101#10112101 –
'$ yesterdow'의 값은 무엇입니까? 귀하의 SQL 쿼리에? – Lion
데이터베이스 테이블에 가정으로 반환 할 적절한 값이 있습니까? – Lion