0

Hi

Can anyone please tel me why my code is not updating my MySQL database?
The code does not return any errors. It does how ever tell me that the update is successful, but there is no update.

Pelase let me know should you require to view the code running prior to this

<?php
session_start();
?>

<?php

$ud_ref=$_POST['ud_ref'];
$ud_date_time=$_POST['ud_date_time'];
$ud_customer_name=$_POST['ud_customer_name'];
$ud_customer_email_address=$_POST['ud_customer_email_address'];
$ud_case_number=$_POST['ud_case_number'];
$ud_msisdn=$_POST['ud_msisdn'];
$ud_route_cause=$_POST['ud_route_cause'];
$ud_escalatedto=$_POST['ud_escalatedto'];
$ud_province=$_POST['ud_province'];
$ud_comments=$_POST['ud_comments'];




if ($ud_ref == "") echo "! No identifier retrieved";
else
echo "<p>Amending record $ud_ref";

//clean up any carriage returns etc
$ud_ref = preg_replace("/[\n\r]*/","",$ud_ref);
$ud_date_time = preg_replace("/[\n\r]*/","",$ud_date_time);
$ud_customer_name = preg_replace("/[\n\r]*/","",$ud_customer_name);
$ud_customer_email_address = preg_replace("/[\n\r]*/","",$ud_customer_email_address);
$ud_case_number = preg_replace("/[\n\r]*/","",$ud_case_number);
$ud_msisdn = preg_replace("/[\n\r]*/","",$ud_msisdn);
$ud_route_cause = preg_replace("/[\n\r]*/","",$ud_route_cause);
$ud_escalatedto = preg_replace("/[\n\r]*/","",$ud_escalatedto);
$ud_province = preg_replace("/[\n\r]*/","",$ud_province);
$ud_comments = preg_replace("/[\n\r]*/","",$ud_comments);


$host = "localhost";
$login_name = "root";
$password = "password";


//Connecting to MYSQL
MySQL_connect("$host","$login_name","$password");

//Select the database we want to use
mysql_select_db("csops") or die("Could not select database");


mysql_query("UPDATE scrubs_tracker 
SET 
ref='$ud_ref'
, date_time='$ud_date_time'
, customer_name='$ud_customer_name'
, customer_email_address='$ud_customer_email_address'
, case_number='$ud_case_number'
, msisdn='$ud_msisdn'
, route_cause='$ud_route_cause'
, escalatedto='$ud_escalatedto'
, province='$ud_province'
, comments='$ud_comments'
, WHERE ref='$ref'");


echo "<BR>Record $ref <-- Updated<BR><BR>";
include "record_updater_scrubs.php";

?>
2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by SalientAnimal
0

Possible reasons can be

  • Your ID of where clause doesn't exist.
  • Use single quotes only for string data types
0

By the ID not existing are you refering to my where clause ref? This ref is generated by the previous search fields from the pages (actions) beore the update.

Would it help to change all single quotes to double quotes?

0

try to echo this ID('ref'). If ID is printing then there will be some other issue..first try to echo ...

0

When I submit I do get a return sayig Reference "Which ever I searched for" updated.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.