$dateBegin=date( 'Y-m-d');
$dateEnd=date( 'Y-m-d');
// $sql = "SELECT smsno FROM SMSTRAN where smsdate BETWEEN '$dateBegin' AND '$dateEnd' ";
// $sql = "SELECT smsno FROM SMSTRAN WHERE STR_TO_DATE(smsdate,'Y-m-d') between STR_TO_DATE('$dateBegin','Y-m-d') and STR_TO_DATE('$dateEnd','Y-m-d') ";
$sql = "SELECT smsno FROM SMSTRAN WHERE smsdate BETWEEN '".$dateBegin." 00:00:00' AND '".$dateEnd." 23:59:59' ORDER BY smsno ";
我收到选择查询的语法错误,我尝试了不同的方法来检索记录,早期的sql语句被评论,都没有用?
答案 0 :(得分:0)
当我在mysql表SMSTRAN中插入一条记录时,上次查询有效。之前在mysql表中没有数据,因此无法正常工作