summaryrefslogtreecommitdiff
path: root/includes/notary.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/notary.inc.php')
-rw-r--r--includes/notary.inc.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index 81c79f0..2e064e6 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -606,14 +606,14 @@
//functions to do with recording user agreements
function write_user_agreement($memid, $document, $method, $comment, $active=1, $secmemid=0){
// write a new record to the table user_agreement
- $query="insert into user_agreements set memid=".$memid.", secmemid=".$secmemid.
- ",document='".$document."',date=NOW(), active=".$active.",method='".$method."',`comment`='".$comment."'" ;
+ $query="insert into `user_agreements` set `memid`=".$memid.", `secmemid`=".$secmemid.
+ ",`document`='".$document."',`date`=NOW(), `active`=".$active.",`method`='".$method."',`comment`='".$comment."'" ;
$res = mysql_query($query);
}
function get_user_agreement_status($memid, $type="CCA"){
//returns 0 - no user agreement, 1- at least one entry
- $query="SELECT u.`document` FROM user_agreements u
+ $query="SELECT u.`document` FROM `user_agreements` u
WHERE u.`document` = '".$type."' AND (u.`memid`=".$memid." or u.`secmemid`=".$memid.")" ;
$res = mysql_query($query);
if(mysql_num_rows($res) <=0){
@@ -630,7 +630,7 @@
}else{
$filter="u.`secmemid`=".$memid;
}
- $query="SELECT u.`document`, u.`date`, u.`method`, u.`comment`, u.`active` FROM user_agreements u
+ $query="SELECT u.`document`, u.`date`, u.`method`, u.`comment`, u.`active` FROM `user_agreements` u
WHERE u.`document` = '".$type."' AND ".$filter."
ORDER BY u.`date` Limit 1;";
$res = mysql_query($query);
@@ -649,9 +649,9 @@
function get_last_user_agreement($memid, $type="CCA"){
//returns an array (`document`,`date`,`method`, `comment`,`active`)
- $query="(SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 1 as `active` FROM user_agreements u WHERE u.`document` = '".$type."' AND (u.`memid`=".$memid." ) order by date desc limit 1)
+ $query="(SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 1 as `active` FROM user_agreements u WHERE u.`document` = '".$type."' AND (u.`memid`=".$memid." ) order by `date` desc limit 1)
union
- (SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 0 as `active` FROM user_agreements u WHERE u.`document` = '".$type."' AND ( u.`secmemid`=".$memid.")) order by date desc limit 1" ;
+ (SELECT u.`document`, u.`date`, u.`method`, u.`comment`, 0 as `active` FROM user_agreements u WHERE u.`document` = '".$type."' AND ( u.`secmemid`=".$memid.")) order by `date` desc limit 1" ;
$res = mysql_query($query);
if(mysql_num_rows($res) >0){
$row = mysql_fetch_assoc($res);