2010-03-19 100 views
0
"SELECT id as Id from dbTable WHERE code = ? AND CURDATE() BETWEEN 
start_date AND end_date AND offerId IN ('12321', '12124')"; 
//Passing arguments for the query 
$args = array_merge(array(51342),$offerid); 

//Execute the prepared query 
$statement->execute($args); 

現在陣列(51342)代表的代碼+價值組合,除了我的數據庫中有值,代碼列,所以我想查詢它看起來邏輯像MySQL查詢:建議所需

"SELECT id as Id from dbTable WHERE code and value 
//(Note here I do not know the syntax, 
//what am looking at is (code+value = ?), please advise on query) = ? 
AND CURDATE() BETWEEN start_date AND end_date AND offerId IN ('12321', '12124')" 

;

回答

0

剛剛得到一個搜索:

"SELECT id as Id from dbTable WHERE concat(code, value) = ? 
AND CURDATE() BETWEEN start_date AND end_date AND offerId IN ('12321', '12124')" 

不知道盡管這會完全正常工作!

謝謝!