gpt4 book ai didi

php - MYSQL - 不插入数据库?

转载 作者:太空宇宙 更新时间:2023-11-03 11:10:22 25 4
gpt4 key购买 nike

<分区>

我的 MYSQL 查询没有通过我制作的表格正确插入。查询:

mysql_query("INSERT INTO Servers(ip, desc, type, title)
VALUES($ip, $desc, $type, $title)"
) or die(mysql_error());

MYSQL表如下:

CREATE TABLE IF NOT EXISTS Servers(
id bigint(20) NOT NULL AUTO_INCREMENT,
ip varchar(50) NOT NULL,
desc text NOT NULL,
type varchar(15) NOT NULL,
title varchar(50) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3;

我已经在表中有两个预制行。表单代码:

<form action="" method="post">
Title: <input type="text" name="title" /><br />
IP: <input type="text" name="ip" /><br />
Description:<br />
<textarea name="desc"></textarea><br />
Type: <input type="text" name="type" /><br />
<input type="submit" name="submit" value="Submit server!" />
</form>

当我提交服务器时,出现以下错误:

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, type,
title) VALUES(a, a, a, a)' at line 1

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