1
我有一個查詢,我已經在phpMyAdmin中運行,並且它返回結果,但是如果我將查詢剪切並粘貼到網頁上的php腳本中,查詢似乎運行但沒有任何結果顯示在頁面上。它也沒有完成加載頁面。該頁面在我的查詢開始的地方結束。基於Web的查詢的執行時間是否可能與通過phpMyAdmin運行的查詢相比耗時過長?下面是查詢:MySQL查詢在phpMyAdmin中可用,但不在php腳本中
$query = "SELECT DISTINCT tblCertificates.WebReportedDt, tblInsHeader.name1, tblInsHeader.name2, tblQuotes.certnum, tblQBalloons.regnum
FROM ((`tblQuotes`
INNER JOIN `tblInsHeader` ON tblQuotes.insuredid = tblInsHeader.insuredid)
INNER JOIN `tblQBalloons` ON tblQuotes.quoteid = tblQBalloons.quoteid)
INNER JOIN `tblCertificates` ON tblQuotes.quoteid = tblCertificates.QuoteID
WHERE (((tblCertificates.WebReportedDt) IS NOT NULL)AND ((tblCertificates.web) = True) AND tblCertificates.WebReportedDt >= '".$MyDate."')
ORDER BY tblCertificates.WebReportedDt DESC , tblInsHeader.name1, tblQuotes.certnum, tblQBalloons.regnum";
$results = mysql_query($query) or die("Query Timed out");
while ($r = mysql_fetch_array($results)) {
extract ($r);
echo $WebReportedDt." - ".$name1." ".$name2." - ".$certnum." - ".$regnum."<br>";
}
的數值指明MyDate var爲當前日期(YYYY-MM-DD HH:SS:ii)以DATETIME格式。
任何想法都會有所幫助。
謝謝!
顯示您的確切PHP代碼。你提供的是不完整的。 –
錯誤報告?如果沒有,你可能只是無法連接到數據庫... – Jasper
你可能是打破你的PHP代碼的引號,並必須逃避你的報價或用反斜槓單引號 –