hi
i'm currently working on a comment system which should be pretty easy to make - but apparently it wont insert any data to my comment table in the db :mad: however, if i change the table to my news table it has no problem doing it.
so i was wondering if you mabye could explain to me what i do wrong?
heres the codes:
(the values get to here, i have checked. it's just the query that wont work!)
<?php
if($_POST['submit']) {
include "inc/connect.php";
$post_id = $_POST['post_id'];
$by = $_POST['by'];
$comment = $_POST['comment'];
$date = time();
mysql_query("INSERT INTO comment (post_id, by, comment, date) VALUES ('$post_id', '$by', '$comment', '$date')");
mysql_close();
echo "<meta http-equiv='refresh' content='0;url=index.php?page=show_post&id=". $post_id ."'>";
}
?>
comment database:
CREATE TABLE `comment` (
`id` int(11) NOT NULL auto_increment,
`post_id` tinytext NOT NULL,
`by` tinytext NOT NULL,
`comment` text NOT NULL,
`date` tinytext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
post database (which works when i change it to insert there)
CREATE TABLE `post` (
`id` int(11) NOT NULL auto_increment,
`headline` tinytext NOT NULL,
`text` text NOT NULL,
`date` tinytext NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
i hope you can help be, cause i'm getting frustrated with this ><''