Hi
I've gotten really confused about this. Here is a seemingly fine PHP script for sending a query to mysql:
$insert = mysql_query("INSERT INTO ".$new_table_name." VALUES('".mysql_real_escape_string($row['datetime'])."', '', '".mysql_real_escape_string($row['type'])."', '".mysql_real_escape_string($row['title'])."', '".mysql_real_escape_string($row['author'])."', '".mysql_real_escape_string($row['thumbnail'])."', '".mysql_real_escape_string($row['short_d'])."', '".mysql_real_escape_string($row['description'])."', ".$row['width'].", ".$row['height'].", '".mysql_real_escape_string($row['flash'])."', '".mysql_real_escape_string($row['status'])."', ".$row['hits'].", ".$row['favourites'].", ".$row['emails'].")");
Yet, it gives me this error (when inserting some dummy information):
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 'VALUES('2009-08-09 22:23:10', '', 'game', 'testgame', 'testuser', ' ', 'short_description_here', '' at line 1
What's going on here?!
here's the table structure:
CREATE TABLE IF NOT EXISTS `user_games` (
`datetime` datetime NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` varchar(15) NOT NULL DEFAULT 'game',
`title` varchar(50) DEFAULT NULL,
`author` varchar(20) DEFAULT NULL,
`thumbnail` text,
`short_d` varchar(60) DEFAULT NULL,
`description` text,
`width` int(4) DEFAULT NULL,
`height` int(4) DEFAULT NULL,
`flash` text,
`status` varchar(15) NOT NULL DEFAULT 'pending',
`hits` int(10) NOT NULL DEFAULT '0',
`favourites` int(10) NOT NULL DEFAULT '0',
`emails` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=146 ;
Thanks