I am trying to write a script that receives the updated data from script called update.php and updates the database entry. The code for updated.php:
<?php
ini_set("display_errors","on");
$dsn='mysql:host=localhost;dbname=inventory_form';
$username="****";
$password="*****";
$database="inventory_form";
$FName_val=$_POST['ud_first'];
$LName_val=$_POST['ud_last'];
$Eqpmnt_Brwd_val=$_POST['ud_Equipment_Borrowed'];
$Service_Tag_val=$_POST['ud_Service_Tag'];
$Date_Taken_val=$_POST['ud_Date_Taken'];
$Comments_val=$_POST['ud_Comments'];
$id_val=$_POST['ud_id'];
try
{
$link=new PDO($dsn, $username,$password);
echo 'Connected To MySQL OK';
}
catch (PDOException $e)
{
$error_message=$e->getMessage();
echo "<h1>An error occurred: $error_message</h1>";
}
$query = "UPDATE Inventory SET FName='$FName_val', LName='$LName_val', Eqmnt_Brwd='$Eqpmnt_Brwd_val', Service_Tag='$Service_Tag_val', Date_Taken='$Date_Taken_val', Comments='$Comments_val' WHERE id_val='$id_val'";
$result=$link->query($query);
echo "Record Updated";
echo $LName_val;
?>
I receive no errors and see the LName_val print out but the database is not being updated. Any help appreciated.