enter image description hereI want to make my chart data.addColumn ('string', 'hour'); must be a string. In my request it is an int.
$temp_array = array();
while($row = mysqli_fetch_assoc($result))
{
$temp_array = array(strval($row["hour"]), $row["min"], $row["max"], $row["Avg"]);
}
result now: "["6","30.0","30.0","30.0"]" want only the first one("6") between quotes.
CodePudding user response:
Use the strval()
to convert integer value to string. For example:
$temp_array[] = array( strval($row["hour"]), strval($row["min"]));
CodePudding user response:
$temp_array = array();
while($row =mysqli_fetch_assoc($result))
{
$temp_array[] = array( (string)$row["hour"], $row["min"], $row["max"], $row["Avg"]);
}
CodePudding user response:
strval($row["hour"])
should do the trick.