Hello, i have some scripts and in the database tabel i have set the dato to int(25) and timestamp
i have a create topic script and then i create a topic it insert the date and time in the timestamp tabel (dato).
but somehow my comment script will not insert the time :S and its the same stuff i use :S.
here is my script
if(isset($_POST['opret_kommentar']))
{ $indhold = $_POST['indhold']; $godkendt = "ja";
$mysql = connect(); $stmt = $mysql->prepare("INSERT INTO forum_kommentare (fk_forum_traad, brugernavn, indhold, dato, godkendt) VALUES (?,?,?,?,?)") or die($mysql->error); $stmt->bind_param('issis', $traadID, $_SESSION['username'], $indhold, $dato, $godkendt) or die($mysql->error); $stmt->execute(); $stmt->close();
$svar = mysqli_insert_id($mysql);
header("location: forum.traad.php?traadID=$traadID&kategoriID=$kategoriID&#$svar");
}
Here is my create topic script so you can see its the same stuff i use :S
if(isset($_POST['send'])) {
$kategoriID = $_GET['kategoriID']; $overskrift = $_POST['overskrift']; $indhold = $_POST['indhold']; $godkendt = "ja";
$mysql = connect();
$stmt = $mysql->prepare("INSERT INTO forum_traad (overskrift, indhold, fk_forum_kategori, brugernavn, dato, godkendt) VALUES (?,?,?,?,?,?)") or die($mysql->error);
$stmt->bind_param('ssisis', $overskrift, $indhold, $kategoriID, $_SESSION['username'], $dato, $godkendt) or die($mysql->error); $stmt->execute(); $stmt->close();
$traadID = mysqli_insert_id($mysql);
header("location: forum.traad.php?traadID=$traadID&kategoriID=$kategoriID");
}#Lukker isset send
here is my SQL
CREATE TABLE IF NOT EXISTS `forum_kommentare` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`fk_forum_traad` int(11) NOT NULL,
`brugernavn` text NOT NULL,
`indhold` mediumtext NOT NULL,
`dato` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`godkendt` varchar(4) NOT NULL DEFAULT 'ja',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Data dump for tabellen `forum_kommentare`
--
-- --------------------------------------------------------
--
-- Struktur-dump for tabellen `forum_traad`
--
CREATE TABLE IF NOT EXISTS `forum_traad` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`overskrift` text NOT NULL,
`indhold` mediumtext NOT NULL,
`fk_forum_kategori` int(11) NOT NULL,
`brugernavn` text NOT NULL,
`dato` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`godkendt` varchar(4) NOT NULL DEFAULT 'ja',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Data dump for tabellen `forum_traad`
hope someone can help me :/