prepare($sql); $sth->execute(); if ($sth->errorInfo()[0] != "00000" && !empty($sth->errorInfo()[0])) { $answer["message"] = (empty($sth->errorInfo()[2])) ? $sth->errorInfo()[0] : $sth->errorInfo()[2]; exit(json_encode($answer)); } $pre = $sth->fetchAll(PDO::FETCH_ASSOC); $output = []; foreach ($pre as $key => $value) { $output = array_merge($output, range($value["rack_form"], $value["rack_to"])); } $answer["output"] = $output; $answer["success"] = 1; exit(json_encode($answer)); ?>