Ik laat via online admin een form invullen om zo berichten te posten op de site. De waarden die via dit formulier worden doorgestuurd, sla ik op in de database. Toch blijkt er iets fout te lopen met onderstaand script:
<?php
// Eerst controlleer ik of de form wel correct is ingevuld en indien ja:
$type = $_POST['type'];
$titel = $_POST['titel'];
$kortetitel = $_POST['kortetitel'];
$speeldag = $_POST['speeldag'];
$thuisploeg = $_POST['thuisploeg'];
$uitploeg = $_POST['uitploeg'];
$thuisscore = $_POST['thuisscore'];
$uitscore = $_POST['uitscore'];
$tekst = $_POST['tekst'];
$sql = "INSERT INTO nieuwsberichten (type, titel, kortetitel, speeldag, thuisploeg, uitploeg, thuisscore, uitscore, tekst) VALUES ($type, $titel, $kortetitel, $speeldag, $thuisploeg, $uitploeg, $thuisscore, $uitscore, $tekst)";
$result = mysql_query($sql);
if( $result )
echo 'Gelukt!';
else
echo 'Mislukt!';
?>
Elke keer retourneert hij 'Mislukt', ik weet niet waarom..
Blijkbaar voert hij de SQL instructie dus niet uit..
807 views