所以我有这段代码:
if($farateze_dec == 0 or $farateze_dec == NULL)
{
$mediageneraladecembrie = VOID;
}
elseif($cuteze_dec == 9 or $cuteze_dec == NULL)
{
$mediageneraladecembrie = VOID;
}
else
{
$mediageneraladecembrie = round(($farateze_dec + $cuteze_dec) / ($numar_note_fara_teza_dec + $numar_note_cu_teza_dec),2);
}
//MEDIA PE Decembrie!
/* pChart library inclusions */
include("class/pData.class.php");
include("class/pDraw.class.php");
include("class/pImage.class.php");
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(1,2,VOID,$mediageneraladecembrie,3,2,1,2), "Probe 1");
哪个输出:
我试图将$ mediageneraladecembrie设置为等于'VOID',但它仍然不起作用。谁知道怎么做?
我需要它是这样的,以防数据库不包含指定月份的任何值。
谢谢!
LATER EDIT:如果我声明变量如$mediageneraladecembrie == VOID
,那么它可以正常工作,但会出现此错误Notice: Use of undefined constant VOID - assumed 'VOID' in C:\wamp\www\pgn\mu.php on line 887
答案 0 :(得分:0)
所以我终于设法做到了。我更改了文件“/class/pData.class.php”中的以下行:
define("VOID", 0.123456789) to define("VOID" , 'VOID');
现在,如果变量的值为'void',它将不会显示在图表中。
发布此答案,希望它能帮助处于相同情况的其他人!