Hi, I am writing a booking system for a Paintball company I work for here in the UK, and I seem to be having trouble with the mysql UPDATE code.
Althogh no errors show, the mysql_affected_rows function returns -1 when I run the script.
Am I missing anything or is there an error in my code, I have been scratching my head over this all day and any help off you guys would be highley appreciated.
My Update script is:
<?
$id=$GET['id'];
$date=$GET['date'];
include("files/sql.connect.php");
$name=$POST['name'];
$telephone=$POST['telephone'];
$email=$POST['email'];
$players=$POST['players'];
$amountpaid=$POST['amountpaid'];
$paytype=$POST['paytype'];
$amountdue=$POST['amountdue'];
$package=$POST['package'];
$notes=$POST['notes'];
$address=$POST['address'];
$amountdue=0;
$query = 'UPDATE northwestp.booking_system SET name = \'$name\', telephone = \'$telephone\', email = \'$email\', players = \'$players\', amountpaid = \'$amountpaid\', paytype = \'$paytype\', amountdue = \'$amountdue\', date = \'$date\', package = \'$package\', notes = \'$notes\', address = \'$address\' WHERE booking_system.bookid = \'$id\' LIMIT 1;';
echo(mysql_affected_rows()); // put in to try and figure out the error
mysql_query($query) or die("Error: ".mysql_error());
echo("<font face=\"Arial\" size=\"3\">Record Updated.</font><hr>");
echo "<form>
<input type=button value=\"Close This Window\" onClick=\"javascript:window.close();\">
</form>
";
mysql_close();
?>
Any help would be greatly appreciated, Thanks in advance.