gpt4 book ai didi

php - 前端查询和 PHP SQL 语句

转载 作者:行者123 更新时间:2023-11-30 00:16:47 25 4
gpt4 key购买 nike

我正在尝试从站点提交查询以从 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);

关于php - 前端查询和 PHP SQL 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23593434/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com