PHP usually works pretty much straight out of the box, but I cannot get this query to work. I am attempting to update a simple record. My code is as follows.
<?php
$customername=mysql_real_escape_string($_POST['customername']);
$contact=mysql_real_escape_string($_POST['contact']);
$customerorder=mysql_real_escape_string($_POST['customerorder']);
$orderplaced=mysql_real_escape_string($_POST['orderplaced']);
$staffmember=mysql_real_escape_string($_POST['staffmember']);
$daterequired=mysql_real_escape_string($_POST['daterequired']);
$status=mysql_real_escape_string($_POST['status']);
$paid=mysql_real_escape_string($_POST['paid']);
$delivery=mysql_real_escape_string($_POST['delivery']);
$ordercontent=mysql_real_escape_string($_POST['ordercontent']);
$orderid=mysql_real_escape_string($_GET['orderid']);
mysql_connect("localhost", "xxxx", "xxxxxxx") or die("Connection Failed");
mysql_select_db("xxxxxx")or die("Connection Failed");
$query = "UPDATE ordermanager_orders SET customername='$customername', contact='$contact', ordernumber='$customerorder', placedby='$orderplaced', requiredby='$daterequired', status=$status', staffmember='$staffmember', paid='paid', delivery='$delivery', ordercontent='$ordercontent' WHERE order='$orderid'";
if(mysql_query($query)){
echo "updated";}
else{
echo "fail";}
?>
The values are being posted or "Getted" from another page. They are definitely coming through as otherwise it comes up with errors. At the moment it simply comes up with 'failed' as per the code.
I have tried numerous variants of code found on the internet, to check if my coding was correct, however I still cannot get it to work.