-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_record.php
63 lines (57 loc) · 1.57 KB
/
save_record.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
session_start();
require_once 'config.php';
require_once 'base/common.php';
require_once 'project_common.php';
require_once $GLOBALS['main_user_location'];
//echo '<br>Sending POST from server<br><pre>';
//print_r($_SESSION);
//print_r($_POST);
//print_r($_FILES);
//echo '<br>With proper POSTing of data by to-script and proper output by from-script AJAX is complate';
//javascript to encode url and PHP to decode POST value is must
//date india vs mysql. Corusponding change in edit_dc.php
//if($_POST['field']=='from_date' ||$_POST['field']=='to_date' )
//{
// $_POST['value']=india_to_mysql_date($_POST['value']);
//}
//echo $_POST['session_name'];
$link=get_link($GLOBALS['main_user'],$GLOBALS['main_pass']);
$released_by=get_one_ex_result($link,$_POST['sample_id'],$GLOBALS['released_by']);
if(strlen($released_by)==0)
{
save_result($link);
}
else
{
echo '<h3>Released samples can not be edited, refresh/view to get previous data</h3>';
}
function save_result($link)
{
$sql='update result
set
result=\''.my_safe_string($link,$_POST['result']).'\',
recording_time=now(),
recorded_by=\''.$_POST['user'].'\'
where
sample_id=\''.$_POST['sample_id'].'\'
and
examination_id=\''.$_POST['examination_id'].'\'';
//echo $sql;
if(!$result=run_query($link,$GLOBALS['database'],$sql))
{
echo '<p>Data not updated</p>';
}
else
{
if(rows_affected($link)>0)
{
echo '<p>'.$_POST['sample_id'].'|'.$_POST['examination_id'].'|'.$_POST['result'].'|Saved in result</p>';
}
else
{
echo '<p>nothing to update (no row / same data)</p>';
}
}
}
?>