Hi I have a code to add reviews for my website. Everything on the forum to fill out is correctly spelled... it just won't insert it into the database
<?php
session_start()
?>
<?php
$db = mysql_connect("localhost","root") or mysql_die ("Unable to Connect to Mysql.. please contact Brandon about this!");
mysql_select_db("mick",$db);
if(isset($_SESSION['username']))
{
$message = $_POST['message'];
$name = $_POST['name'];
$rating = $_POST['rating'];
$bands = $_POST['bands'];
$when = $_POST['when'];
$where = $_POST['where'];
$message = nl2br($message);
$sql = "INSERT INTO review (name , message , rating , bands , when , where) VALUES ('$name', '$message', '$rating', '$bands', '$when', '$where')";
$result = mysql_query($sql);
echo "<html><head><body bgcolor='#000000'><font color='#FFFFFF' face='Arial, Helvetica, sans-serif' size='-2'><a href=news.php target=niglet>Thanks for posting.. click to go the the main page</a></font>";
}
else {
echo "<html><head><body bgcolor='#000000'><font color='#FFFFFF' face='Arial, Helvetica, sans-serif' size='-2'>You need to login before you can access this page...</font>";
}
?>
Any Help would be appreciated
When I trouble shoot it I get...
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 'when, where) VALUES ('Name', 'Review', '10/10', 'Bands', 'When'