Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate query in MySQL and PHP not working
    primarykey
    data
    text
    <p>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.</p> <pre><code>&lt;?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";} ?&gt; </code></pre> <p>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.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload