My MYSQL query isn't inserting properly via a form I had made. The query:
mysql_query("INSERT INTO Servers(ip, desc, type, title)
VALUES($ip, $desc, $type, $title)"
) or die(mysql_error());
The MYSQL table is as follows:
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;
I already have two pre-made rows in the table. The form code:
<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>
When I submit a server, I get the following error:
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