phpsqlcomments

PHP mysql table for comments


I am adding comments to a website and thought I would make a simple comments table as follows but it is not working. Must be a typo but I cannot find it despite going over and over it and copying it into a different file and so forth. Also for those familiar with comments are these an adequate number of fields?

$maketable = "CREATE TABLE comments(id INT NOT NULL AUTO_INCREMENT, 
 PRIMARY KEY(id),
 name VARCHAR(30),
 whenadded DATETIME,
 storyid INT,
 comment TEXT,
 show TINYINT(1),
 userid INT)";
mysql_query($maketable);

Solution

  • I think 'show' is a reserved word in mysql. Try 'display' or something else:

    $maketable = "CREATE TABLE comments(id INT NOT NULL AUTO_INCREMENT, 
     PRIMARY KEY(id),
     name VARCHAR(30),
     whenadded DATETIME,
     storyid INT,
     comment TEXT,
     display TINYINT(1),
     userid INT)";
    mysql_query($maketable);