id; $datemodified = date('YmdHis'); $return_action = $_REQUEST['return_action']; $return_module = $_REQUEST['return_module']; $return_id = $_REQUEST['return_id']; $mode = $_REQUEST['mode']; if(isset($mode) && $mode != '' && $mode == 'Edit') { $faqid = $_REQUEST['id']; $query="update faq set question='".$question."',answer='".$answer."',category='".$category."',date_modified=".$adb->formatString("faq","date_modified",$datemodified).",comments='".$comment."' where id=".$faqid; //echo $query; $adb->query($query); } else { //Inserting value into faqs table table $query="insert into faq values('','".$question."','".$answer."','".$category."','".$author_id."',".$adb->formatString("faq","date_modified",$datemodified).",".$adb->formatString("faq","date_modified",$datemodified).",'".$comment."','0')"; $adb->query($query); //Retreiving the id $idquery = "select max(id) as id from faq"; $idresult = $adb->query($idquery); $return_id = $adb->query_result($idresult,0,"id"); } $loc = "Location: index.php?action=".$return_action."&module=".$return_module."&record=".$return_id; //echo "locisss ".$loc; header($loc); ?>