As per my subject line I need to change the below code.
1) Actually I want to write a time deference to be automatically calculated between Report_Date, Resolved_Date & updated in the SLA column. can you please help me with this calculation.
a) If resolved_date is not selected in the form then the value of the SLA can be Null, One resolved_date is updated it should automatically update time difference In SLA. also time should be in format (hhh:mm:ss).
2) on inserting a record it should first redirect to the page mentioned and then alert the message saying "record inserted successfully"
$host="localhost"; // Host name
$username="test"; // Mysql username
$password="1234"; // Mysql password
$db_name="testapp"; // Database name
$tbl_name="user_supp"; // Table name
$myusername = $_SESSION['myusername']; //user who updating
$con = mysql_connect("$host","$username","$password")or die("cannot connect to server");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="INSERT INTO $tbl_name( `prefix`,`Analyst`, `Email`, `Report_Date`, `Resolved_Date`, `Issue_des`, `Resolution_des`, `SLA`)
header("location:support_update.php") or die("record not inserted");
echo 'alert("you have successfully added one user !" );';
echo ' window.location="support.php";';
Impossible. The location header is handled by the client which then ignores the body. You cannot have an alert if you are using a location. An unofficial header of Refresh: 5; url=http://site.com/page would allow you to do this as it will wait 5 seconds before it redirects. Meta headers could also be used for a similar effect. Refresh header is not a part of RFC-2616 standards though, so there is no guarantee that it will work.