简体   繁体   中英

how to change row font color or background color base on values in PHP json im using bootgrid

THIS IS MY PHP CODE how can i changed the font color of specific row based on the value

$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;
    }

Add more details about your client-side code. according to comments, you can change your code to this one:

...
while( $row = mysqli_fetch_assoc($queryRecords) ) {
    if ($you_want)
        $row['remarks'] = 'ACTIVE';
    $data[] = $row;
}
...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM