I cannot get this mysql update query to work. Please help. I am new at this.:)
<?PHP
session_start();
?>
<?php
//it's getting the data from the post fine. I know this part is working.
$ud_id=$_POST['ud_id'];
$ud_fname=$_POST['ud_fname'];
$ud_lname=$_POST['ud_lname'];
$ud_type=$_POST['ud_type'];
$ud_used=$_POST['ud_used'];
$ud_sdate=$_POST['ud_sdate'];
$ud_edate=$_POST['ud_edate'];
if ($ud_id == "") echo " No record ID supplied! <br>";
else
echo "Amending record $ud_id";
if ($ud_id == "") echo " ";
else
echo "<br> Employee Name: $ud_fname $ud_lname";
//clean up any carriage returns etc
$ud_fname = preg_replace("/[\n\r]*/","",$ud_fname);
$ud_lname = preg_replace("/[\n\r]*/","",$ud_lname);
//Select the database we want to use
$db = mysql_connect("localhost", "root", "");
mysql_select_db("test1",$db) or die ('Unable to connect to database');
//NOT WORKING
mysql_query("UPDATE persons SET FirstName ='$ud_fname', LastName ='$ud_lname', Type ='$ud_type', DaysUsed ='$ud_used', StartDate ='$ud_sdate', EndDate ='$ud_edate', WHERE ID = '$ud_id'");
if ($ud_id == "") echo " ";
else
echo "<BR>Record Updated<BR><BR>";
?>
<?php
I then display the new data, but data is not updated.