0

I get this error message: Insert 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 'testing this thing again' at line 2

NOTE: the 'testing this thing again' is $body


This is my MySQL setup.

CREATE TABLE `articles` (
  `id` int(20) NOT NULL auto_increment,
  `loginid` varchar(19) NOT NULL,
  `title` varchar(25) NOT NULL,
  `author` varchar(30) NOT NULL,
  `body` text NOT NULL,
  `date` date default NULL,
  `category` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 AUTO_INCREMENT=16 ;
$db="xxxxxx";
$link = mysql_connect('xxxxx.xxxxxx.com', 'xxxxx','xxxxxx');
if (! $link) die(mysql_error());
mysql_select_db($db , $link) or die("Select Error: ".mysql_error());
$result=mysql_query("INSERT INTO articles (`loginid`,`title`,`author`,`body`,`date`,`category`) 
VALUES ('".$loginid."','".$title."','".$author.",'".$body."','".$today."','".$category."')")
or die("Insert Error: ".mysql_error());
mysql_close($link);
print "Record added\n";

Any help is appreciated!

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
1
mysql_query("INSERT INTO articles (`loginid`,`title`,`author`,`body`,`date`,`category`) VALUES ('$loginid','$title','$author','$body','$today','$category')") or die...
Votes + Comments
tsk tsk tsk
0

Thanks again. I'll come eat your brain Ardav maybe i get some of that knowledge! >:)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.