Why is is giving me an SQL syntax error?

Posted by Tibo on Stack Overflow See other posts from Stack Overflow or by Tibo
Published on 2010-04-05T20:50:13Z Indexed on 2010/04/05 20:53 UTC
Read the original article Hit count: 265

Filed under:
|
|

Do you have any idea why i get this:

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 '``, `title` varchar(255) collate latin1_general_ci NOT NULL default ``,' at line 3

The code is like this (the part im having problem with...)

$sql = 'CREATE TABLE `forum` (
                        `postid` bigint(20) NOT NULL auto_increment,
                        `author` varchar(255) collate latin1_general_ci NOT NULL default ``,
                        `title` varchar(255) collate latin1_general_ci NOT NULL default ``,
                        `post` mediumtext collate latin1_general_ci NOT NULL,
                        `showtime` varchar(255) collate latin1_general_ci NOT NULL default ``,
                        `realtime` bigint(20) NOT NULL default `0`,
                        `lastposter` varchar(255) collate latin1_general_ci NOT NULL default ``,
                        `numreplies` bigint(20) NOT NULL default `0`,
                        `parentid` bigint(20) NOT NULL default `0`,
                        `lastrepliedto` bigint(20) NOT NULL default `0`,
                        `author_avatar` varchar(30) collate latin1_general_ci NOT NULL default `default`,
                        `type` varchar(2) collate latin1_general_ci NOT NULL default `1`,
                        `stick` varchar(6) collate latin1_general_ci NOT NULL default `0`,
                        `numtopics` bigint(20) NOT NULL default `0`,
                        `cat` bigint(20) NOT NULL,
                        PRIMARY KEY  (`postid`)
                        );';
                mysql_query($sql,$con) or die(mysql_error());

Help would be greatly appreciated!

© Stack Overflow or respective owner

Related posts about sql

Related posts about php