score:2

you got syntax error

$sql = "select * from ".$depar" where fecha_id = '".$date"' and hora_id >= '".$ini"' and hora_id <= '".$fin"'";
                             ^                           ^                         ^                          ^                                                                      
                            here                       here

also mysql_* functions are officially deprecated as of php 5.5 (released june 2013). has been removed entirely as of php 7.0 (released december 2015), use mysqli_* or pdo

for better readability, you can also use heredoc like below

$sql = <<<eof
select * 
from `$depar` 
where `fecha_id` = '$date' and 
      `hora_id` >= '$ini'  and 
      `hora_id` <= '$fin'
eof;

/* above you can also use between
  `hora_id` between '$ini' and '$fin'
*/

$mysqli = new mysqli("localhost", "my_user", "my_password", "database");

/* check connection */
if ($mysqli->connect_errno) {
    printf("connect failed: %s\n", $mysqli->connect_error);
    exit();
}

$output = array();

if ($result = $mysqli->query($sql)) {

    /* fetch associative array */
    while ($row = $result->fetch_assoc()) {
        $output[] = $row;
    }

    /* free result set */
    $result->free();
}

/* close connection */
$mysqli->close();

/*some error handling if array is empty*/
if(empty($output)){
       /*
            couldn't create plot,
      */
}

and in your highchart options

xaxis: {
       // your will get [charid, charid2, charid2, ... ]
      categories: <?php echo json_encode(array_column($output,'timechar_id'),json_numeric_check); ?>
  },

and in series data

series: [{
        name: 'lpz',

        // your will get [id1, id2, id2, ... ]
        data: <?php echo json_encode(array_column($output,'pingchar_id'),json_numeric_check); ?>
}]

Related Query

More Query from same tag