probably something stupid as my MySQL PHP knowledge is so rusty.. ive cleaned up all the errors i could and still i cannot write to my DB. Can anyone shed some light on what may be wrong, as its not even printing an error out anymore. Thanks:
<?php
$conn=mysql_connect("127.0.0.1","root","","pe_results");
if (isset($_POST['Name'])) {
$Name = $_POST['Name'];
}
if (isset($_POST['Short'])) {
$Short = $_POST['Short'];
}
if (isset($_POST['Med'])) {
$Med = $_POST['Med'];
}
if (isset($_POST['Long'])) {
$Long = $_POST['Long'];
}
if (isset($_POST['VLong'])) {
$VLong = $_POST['VLong'];
}
if (isset($_POST['Extreme'])) {
$Extreme = $_POST['Extreme'];
}
if (isset($_POST['LJump'])) {
$LJump = $_POST['LJump'];
}
if (isset($_POST['HJump'])) {
$HJump = $_POST['HJump'];
}
if (isset($_POST['Shotputt'])) {
$Shotputt = $_POST['Shotputt'];
}
if (isset($_POST['Discuss'])) {
$Discuss = $_POST['Discuss'];
}
if (isset($_POST['Javelin'])) {
$Javelin = $_POST['Javelin'];
}
if (isset($_POST['Date'])) {
$Date = $_POST['Date'];
}
if (isset($_POST['Year'])) {
$Year = $_POST['Year'];
}
$sql="INSERT INTO results_main (Name, Short, Med, Long, VLong, Extreme, LJump, HJump, Shotputt, Discuss, Javelin, Date, Year)
VALUES ('$Name', '$Short', '$Med', '$Long', '$VLong', '$Extreme', '$LJump', '$HJump', '$Shotputt', '$Discuss', '$Javelin', '$Date', '$Year')";
$result = mysql_query($sql,$conn);
if($result){
echo"<br/>Everythings been saved";
echo "<BR>";
echo "<a href='index.html'>Back to the main page</a>";
}
else {
echo 'Fatal Error, you information has not been saved';
}
// close connection
mysql_close($conn);
?>
Here is the update:
The query is: INSERT INTO results_main (Name, Short, Med, Long, VLong, Extreme, LJump, HJump, Shotputt, Discuss, Javelin, Date, Year) VALUES ('Chris Davern', '10:00', '20:00', '40:00', '80:00', '15:00', '100m', '10m', '15m', '50m', '400m', '2013-03-27', '9')
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 'Long, VLong, Extreme, LJump, HJump, Shotputt, Discuss, Javelin, Date, Year) ' at line 1