Hi I have a table that records details which then after the record is saved I can use the link to update the diary. one field is a simple Job reference, the second is basically all the rest, name address etc inserted into a memo field in the diary, this is what I've come up with can I have some guidance please.
<?php
//record identifier date format 0000-00-00 same as server
$Dt = $_REQUEST['DT'];
// text output for appontment
$A = $_REQUEST['A'];
$B = $_REQUEST['B'];
$C = $_REQUEST['C'];
$D = $_REQUEST['D'];
$E = $_REQUEST['E'];
$F = $_REQUEST['F'];
$G = $_REQUEST['G'];
$H = $_REQUEST['H'];
$I = $_REQUEST['I'];
$J = $_REQUEST['J'];
$K = $_REQUEST['K'];
$L = $_REQUEST['L'];
$M = $_REQUEST['M'];
$N = $_REQUEST['N'];
// field names to reference
$APP = $_REQUEST['P'];
$JD = $_REQUEST['Q'];
// Field content
$JN = $_REQUEST['JID'];
$Desc = $"" . $A . "" . $B . " " . $C . ". " . $D . ", " . $E . " " . $F . " " . $G . " TF " . number_format($H,0, $decimal_point,"") . " " . $I . ", " . $J . " Walls, " . number_format($K,0, $decimal_point,"") . "Beds. " . $J . " " . $K . " boiler, with " . number_format($L,0, $decimal_point,"") . " radiators. notes " . $M . " observations " . $N . "";
?>
<?php
$servername = "localhost:3306";
$username = "xxxdjw";
$password = "xxxxxx";
$dbname = "xxxxx";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "UPDATE masterdiary SET $APP ='$JN', $JD = '$Desc' WHERE date = '$dt'";
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
$conn->close();
?>
Or would it be easier to try and write a trigger?