我正在尝试从站点提交查询以从MySQL数据库中检索某些记录。当我从站点表单执行查询时,当我知道它不为空时,我得到“无效查询:查询为空”的mysql_error()返回。

$Level = $_POST['level'];
$Year  = $_POST['year'];
$Name  = $_POST['name'];
$Award  = $_POST['award'];

$query = mysql_query("SELECT *
    FROM wineawards
    WHERE LEVEL = $Level
      OR YEAR = $Year
      OR name = $Name
      OR award = $Award

    ");

$result = mysql_query($query);


不确定我是否在这里遗漏了什么,或者输入了错误的内容?

最佳答案

$query = mysql_query("SELECT *
    FROM wineawards
    WHERE LEVEL = '$Level'
      OR YEAR = '$Year'
      OR name = '$Name'
      OR award = '$Award'

    ");

$result = mysql_query($query);

07-27 17:36