我页面上的代码似乎没有加载 - 我认为程序逻辑有点多。
$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;
}
它应该用不同的数值计算不同日期的数组,但页面拒绝加载 - 但在我把这段代码放在那里之前它确实加载了。