IF语句错误的结果

时间:2015-07-24 16:56:16

标签: php css sql oracle

我遇到的问题我不太明白为什么。我正在搞乱timeglider时间线,我希望用红色显示关键数据,用黑色显示普通数据。每次while运行时,它都会将一个注册表(id,title,startdate,...)放入数组中。时间轴还有一个选项(css_class),允许更改resgitry css。为此,我执行以下操作:if ($res2['CRITICO'] == '1'){$vs['css_class']='hot-event';}Hot-event只是我创建的具有color:red的css类。问题是结果,除了将CRITICO =='1'转换为红色(预期)之外,它结束了变为红色的一些注册表CRITICO =='0',这是没有意义的,因为我有If }。也是为什么只选择少数而不是全部甚至更奇怪。在数据库中CRITICO是varchar类型,所以我不知道我的If语句有什么问题

$query2 = "SELECT DISTINCT PROCESSO,  TO_CHAR(DATAMSG,'YYYY-MM-DD HH24:mi') AS DATAMSG, CATEGORIA_DESC, VALOR, CRITICO FROM PATIENT_TIMELINE_VS20152S c
     WHERE PROCESSO = ".$nprocesso." AND (trim(CATEGORIA_DESC)) IN ('ART_DIA','SPO2','ART_SYS','TEMP_T1','ECG_HR') AND  TO_CHAR(DATAMSG,'YYYY-MM-DD HH24:MI:SS') IN
          (SELECT DISTINCT MIN(TO_CHAR(DATAMSG,'YYYY-MM-DD HH24:MI:SS'))
          FROM PATIENT_TIMELINE_VS20152S A
          where c.CATEGORIA_DESC = a.CATEGORIA_DESC
          GROUP BY PROCESSO, TO_CHAR(DATAMSG,'YYYYMMDDHH24'))
          ORDER BY  PROCESSO, DATAMSG ASC";
    $result2 = oci_parse($connect, $query2);
    oci_execute($result2);

$a=0;

while($res2 = oci_fetch_array($result2) AND $res5 = oci_fetch_array($result5))  {
 $a++;   
 $vs['id']= $a;
 $vs['title']='VS - '.$res2['CATEGORIA_DESC'];
 $vs['startdate']=$res2['DATAMSG'];
 $vs['enddate']=$res2['DATAMSG'];
 $vs['description']= '1ºH - '.$res2['VALOR'].'| MAX - '.$res5['MAXVAL'].'| MIN - '.$res5['MINVAL'].'| AVG - '.$res5['AVGVAL'].'| crit- '.$res2['CRITICO'];
 $vs['date_display']='ho';
 $vs['icon']='plus_blue.png';
 $vs['importance']='30';

 if ($res2['CRITICO'] == '1'){
 $vs['css_class']='hot-event';
 }
 array_push($vs1,$vs);

0 个答案:

没有答案