-1
我怎樣寫這樣的事情與PDO?:我怎樣寫有多個值的PDO準備語句現場
$query = "SELECT *
FROM trx
WHERE item_id = $item_id
AND NOT (trx_state=3 OR trx_state=4)
這是我有:
$query = 'SELECT *
FROM trx
WHERE item_id = :item_id AND NOT (trx_state = :trx_state OR trx_state = :trx_state';
$stmt = $db->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
$stmt->execute(array(':item_id' => $item_id, ':trx_state' => '3', '4'));
我m不完全確定如何設置它在哪裏:trx_state同時具有值3和4.
'trx_state IN(:state_1,:state_2)'然後綁定到那些? – tadman