$q=2013
$sql="SELECT * FROM vip_sales WHERE type = 'vecka' and date >= '"$q ."-01-01' and date <= '"$q ."-01-31' ";
$result = mysql_query($sql, $con);
$janw = mysql_num_rows($result);
$sql="SELECT * FROM vip_sales WHERE type = 'manad' and date >= '"$q ."-01-01' and date <= '"$q ."-01-31' ";
$result = mysql_query($sql, $con);
$janm = mysql_num_rows($result);
$sql="SELECT * FROM vip_sales WHERE type = 'ar' and date >= '"$q ."-01-01' and date <= '"$q ."-01-31' ";
这一行 '"$q ."-01-01' 是 = "2013-01-01" 吗?
我用来构建代码的程序说有一个错误,但我找不到任何错误,我在我的 PHPadmin 中测试了这个
$sql="SELECT * FROM vip_sales WHERE type = 'ar' and date >= '2013-01-01' and date <= '2013-01-31' ";
它工作正常。我只是想确保这是使用正确的线路。Cuse 当我测试时
$sql="SELECT * FROM vip_sales WHERE type = 'ar' and date >= '"2013 ."-01-01' and date <= '"2013 ."-01-31' ";
它没有工作。我可能混淆了'和'。
感谢所有帮助