How to select with a binary field ? (php,mysql)

前端 未结 2 935
情歌与酒
情歌与酒 2021-01-19 05:30

Try to select use \"where\" clause in a mysql statement: e.g. Table: X with a ID column which is BINARY data type. Then save in a variable in php

$aid = $row         


        
2条回答
  •  情话喂你
    2021-01-19 05:53

    Answering my own question.

    Just figured out:

    $where = "where HEX(ID) = 'bin2hex($aid)'";
    $query = "SELECT * FROM X ".$where;
    

    Does anyone know better solution?

提交回复
热议问题