THE MISSING _ WAS A TYPO ON STACKOVERFLOW, I WAS TESTING.
I'm trying to insert a value to my database using the following two files:
Add Record:
<form action="AddVenue.php" method="post" />
<p>Venue Name: <input type="text" name="venue_name" /></p>
<p>Venue Capacity: <input type="text" name="venue_capacity" /></p>
<input type="submit" value="Submit" />
</form>
AddVenue.php
<?php
require("dbconnection.php"); // Connect to Database
// Select Database
$db= 'database';
mysql_select_db($db) or die("Could not select database");
$venue_name = $_POST['venue_name'];
$venue_capacity = $_POST['venue_capacity'];
$sql = "INSERT INTO Venues (venue_name) VALUES ('$venue_name')";
$sql = "INSERT INTO Venues (venue_capacity) VALUES ('$venue_capacity')";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
mysql_close();
?>
At the moment, it adds the to the field venue_capacity without fault, however it always adds NULL to the venue_name field. The capacity field is an INT, and the name field is VARCHAR.
I have no idea why it's doing it, they are the same a pat from the names, which I have double and triple checked. Does anyone have any ideas?