gpt4 book ai didi

php - MySql 查询错误

转载 作者:行者123 更新时间:2023-11-29 01:07:25 26 4
gpt4 key购买 nike

<分区>

我在使用此 MySql 查询时遇到问题:

INSERT INTO groups (NAME, DESC, TIME, OWNER) VALUES ('$GNAME', '$DESC', '$TIME', '$UID')

本质上,该脚本将组名、描述、时间和组注册人的用户名添加到 mysql 数据库中。

完整脚本:

<?php
include_once('include/session.php');
$GNAME = $_POST['groupname'];
$DESC = $_POST['desc'];
$SPAM = $_POST['spam'];
$UID = $_POST['UID'];
$TIME = date('Y-m-d H:i:s');
if($SPAM == "queuee"){


$query ="INSERT INTO groups (NAME, DESC, TIME, OWNER) VALUES ('$GNAME','$DESC','$TIME', '$UID')";

$result = mysql_query($query) or die("There as been an Error! <hr>Error:<hr>".mysql_error() ."<br><hr><a href=\"../index.php\">Go Back</a>");
header("Location: ../group.php?id=$GNAME");
}else{
?>
The Security Question was wrong. Try Again.

<?
}
?>

我使用 Phpmyadmin 将查询直接运行到 MySql 本身。但是它仍然抛出错误。错误是:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC, TIME, OWNER) VALUES ('$GNAME', '$DESC', '$TIME', '$UID')' at line 1

非常感谢任何帮助,也许我是个彻头彻尾的傻瓜,没有注意到一个明显的错误。如果您需要更多信息,请询问!

非常感谢。

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