Any advice would be great, thanks!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 '' at line 1
This is my show_addrecord.html
Code: Select all
<html>
<head>
<title>Adding a Record</title>
<h1> Adding a record to my_roster</h1>
<form method= "post" action= "showrecord.php">
<br> Jersey Number: <input type= "text" name= "mid"> <br>
<br>Birthday(YYYY-MM-DD): <input type= "text" name= "birthday" ><br>
<br>Athletes Last Name (or Nickname): <input type= "text" name= "artist_ln" ><br>
<br>Format: <input type= 'radio' name = "format" value= 'Guard'>Guard
<input type= 'radio' name= "format" value= 'Forward'>Forward
<input type= 'radio' name= "format" value= 'Pointguard'>Pointguard
<input type= 'radio' name= "format" value= 'Center'>Center</br>
<br><h2>Stats:</h2></br>
<textarea rows= '5' cols= '20' name= "notes" wrap= "physical"></textarea>
<p><input type= "submit" name= "submit" value= "add record" </p><br>
</html>
</form>]This is my php code to output the "results"
Code: Select all
<?
if ((!$_POST['mid']) || (!$_POST['format']) || (!$_POST['artist_ln'])) {
header("Location: show_addrecord.html");
exit;
}
$db_name="my_roster";
$table_name="players";
// Create the connection
$connection = @mysql_connect( "localhost", "Shawn", "1234" );
$db = @mysql_select_db( $db_name,$connection) or die (mysql_error());
$sql = "INSERT INTO $table_name (mid, format, artist_ln, birthday, notes) VALUES ('$_POST[mid]', ('$_POST[format]', '$_POST[artist_ln]', '$_POST[birthday]', '$_POST[notes]')";
$result = @mysql_query($sql,$connection) or die(mysql_error());
?>
<P><STRONG>Jersey Number:</STRONG><BR>
<? echo stripslashes ("$_POST[mid]"); ?>This is where it will be shown ^^ just did one to see if it works but did not (p.s. I have to use stripslashes)