[英]how to change row font color or background color base on values in PHP json im using bootgrid
这是我的 PHP 代码如何根据值更改特定行的字体颜色
$sql = "SELECT * FROM employee "; $sqlTot .= $sql; $sqlRec .= $sql;
if(isset($where) && $where != '') {
$sqlTot .= $where;
$sqlRec .= $where;
}
if ($rp!=-1)
$sqlRec .= " LIMIT ". $start_from .",".$rp;
$qtot = mysqli_query($this->conn, $sqlTot) or die("error to fetch tot seaman's data");
$queryRecords = mysqli_query($this->conn, $sqlRec) or die("error to fetch seaman's data");
while( $row = mysqli_fetch_assoc($queryRecords) ) {
$data[] = $row;
}
$json_data = array(
"current" => intval($params['current']),
"rowCount" => 10,
"total" => intval($qtot->num_rows),
"rows" => $data // total data array
);
return $json_data;
}
添加有关客户端代码的更多详细信息。 根据评论,您可以将代码更改为:
...
while( $row = mysqli_fetch_assoc($queryRecords) ) {
if ($you_want)
$row['remarks'] = 'ACTIVE';
$data[] = $row;
}
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.