gpt4 book ai didi

php - MySQL 查询为空

转载 作者:行者123 更新时间:2023-11-30 01:17:19 24 4
gpt4 key购买 nike

这意味着从 URL 获取数据并将其提交到数据库,但出现错误:查询为空;

我在其中添加了更多内容来测试,是的,它给出了我设置的变量的值。提前致谢

<?php
require 'variables.php';
if(empty($_REQUEST['Key']) || empty($_REQUEST['Computer']) || empty($_REQUEST['Panel'])){
die("Nothing was given for me to give back :(");
}else{
$key = $_REQUEST['Key'];
$computer = $_REQUEST['Computer'];
$panel = $_REQUEST['Panel'];
$insertquery = mysql_query("INSERT INTO keys (Key, PC, Panel) VALUES ('".$key."', '".$computer."', '".$panel."')");
$sql = mysql_query($insertquery);
if($sql){
echo "good ". mysql_error();
}else{
echo "bad ". mysql_error();
echo "<br />".$key." ".$computer." ".$panel."";
}
}

?>

最佳答案

您正在调用 mysql_query() 两次。这就是问题所在

这样做

<?php
require 'variables.php';
if(empty($_REQUEST['Key']) || empty($_REQUEST['Computer']) || empty($_REQUEST['Panel'])){
die("Nothing was given for me to give back :(");
}else{
$key = $_REQUEST['Key'];
$computer = $_REQUEST['Computer'];
$panel = $_REQUEST['Panel'];
$insertquery = "INSERT INTO keys (Key, PC, Panel) VALUES ('".$key."', '".$computer."', '".$panel."')";
$sql = mysql_query($insertquery);
if($sql){
echo "good ". mysql_error();
}else{
echo "bad ". mysql_error();
echo "<br />".$key." ".$computer." ".$panel."";
}
}

?>

关于php - MySQL 查询为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18933013/

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