我的頁面上的代碼似乎沒有加載 - 我認爲程序邏輯對它來說有點多。這段代碼能否產生一個無限循環?
$resultromney = mysql_query("SELECT category, value, timestamp from results where name='".$chartname2."'");
if (!$resultromney) {
die('Invalid query, please contact administrator');
}
$posromney = 0;
$negromney = 0;
$dateromney = "1/1/2012";
$romray = array();
while ($twitromney = mysql_fetch_assoc($resultromney))
{
$romneytime = intval($twitromney["timestamp"]);
$romneydate = date('m/d/Y', $romneytime);
$romlinearray = array();
$romlinearray["date"] = null;
$romlinearray["value"] = null;
$romneydiff = date_diff($dateromney, $romneydate);
$PLromney = 0;
$NLromney = 0;
$totalromney = 0;
if ($romneydiff == 0) {
switch ($twitromney["category"]) {
case "composed":
$PLromney = $PLromney + $twitromney["value"];
break;
case "elated":
$PLromney = $PLromney + $twitromney["value"];
break;
case "clearheaded":
$PLromney = $PLromney + $twitromney["value"];
break;
case "agreeable":
$PLromney = $PLromney + $twitromney["value"];
break;
case "energetic":
$PLromney = $PLromney + $twitromney["value"];
break;
case "unsure":
$NLromney = $NLromney + $twitromney["value"];
break;
case "tired":
$NLromney = $NLromney + $twitromney["value"];
break;
case "depressed":
$NLromney = $NLromney + $twitromney["value"];
break;
case "guilty":
$NLromney = $NLromney + $twitromney["value"];
break;
case "confused":
$NLromney = $NLromney + $twitromney["value"];
break;
case "anxious":
$NLromney = $NLromney + $twitromney["value"];
break;
case "hostile":
$NLromney = $NLromney + $twitromney["value"];
break;
case "confident":
$PLromney = $PLromney + $twitromney["value"];
break;
}
$totalromney = $PLromney - $NLromney;
$romlinearray["value"] = $totalromney + $romlinearray["value"];
}
else {
$dateromney = $romneydate;
switch ($twitromney["category"]) {
case "composed":
$PLromney = $PLromney + $twitromney["value"];
break;
case "elated":
$PLromney = $PLromney + $twitromney["value"];
break;
case "clearheaded":
$PLromney = $PLromney + $twitromney["value"];
break;
case "agreeable":
$PLromney = $PLromney + $twitromney["value"];
break;
case "energetic":
$PLromney = $PLromney + $twitromney["value"];
break;
case "unsure":
$NLromney = $NLromney + $twitromney["value"];
break;
case "tired":
$NLromney = $NLromney + $twitromney["value"];
break;
case "depressed":
$NLromney = $NLromney + $twitromney["value"];
break;
case "guilty":
$NLromney = $NLromney + $twitromney["value"];
break;
case "confused":
$NLromney = $NLromney + $twitromney["value"];
break;
case "anxious":
$NLromney = $NLromney + $twitromney["value"];
break;
case "hostile":
$NLromney = $NLromney + $twitromney["value"];
break;
case "confident":
$PLromney = $PLromney + $twitromney["value"];
break;
}
$totalromney = $PLromney - $NLromney;
$romlinearray["date"] = $romneydate;
$romlinearray["value"] = $totalromney;
}
$romray[] = $romlinearray;
}
它應該計算不同天,不同數量的陣列的值,而是頁面被拒絕加載 - 但它確實負荷之前,我把這個代碼在那裏。
首先評論一段代碼,並嘗試反覆運行。 –
對不起,但是羅姆尼的這個問題太多了。 – kalpaitch
在旁邊,你有沒有聽說過跌落? – Sherlock