PostgreSQL:错误:运算符不存在:字符变化=整数

时间:2019-05-20 04:38:10

标签: php postgresql

  

警告:pg_query():查询失败:错误:运算符不存在:字符变化。因为节列是整数,sub_sec_id列是字符变化See table please

此错误显示WHERE section = {$values['section']} AND sub_sec_id = {$values['sub_sec_id']}这一行。

$data = [];
$branchs = [];
$query = pg_query($con,"SELECT DISTINCT branchcode FROM mnw.cal_section_point WHERE event_id BETWEEN 71 AND 75");
while($values=pg_fetch_array($query)){
    $branchs[] = $values['branchcode'];
}

$query = pg_query($con,"SELECT DISTINCT section, sub_sec_id, point FROM mnw.cal_section_point
         WHERE event_id BETWEEN 71 AND 75");
// $res = pg_query($con, $query);


while ($values = pg_fetch_array($query)) {
    $tmp['si'] = $values['section'] . "." . $values['sub_sec_id'];
    $tmp['section'] = $values['section'];
    $tmp['fullmark'] = $values['point'];

    $query = pg_query($con,"SELECT branchcode,
        question_point
        FROM mnw.cal_section_point
        WHERE section = {$values['section']}
        AND sub_sec_id = {$values['sub_sec_id']}
        AND event_id BETWEEN 71 AND 75");

    // $rs = pg_query($con, $query);
    while ($row = pg_fetch_array($query)) {
        $tmp['branchs'][$row['branchcode']] = $row['question_point'];
    }
    $data[$tmp['si']] = $tmp;
}

0 个答案:

没有答案