1

我有一个 index.php 页面。一开始我session_start(); 在我的 index.php 中包含以下内容

 <div id="affinfocol">          
            <?php include ("search.php"); ?>
            <?php include ("affInfo.php"); ?>
            <!-- Right Col -->
            <div id="rightcol"><br>
                <?php include ("adeAff.php"); ?>
            </div>          
        </div>
        <!--Affilaition -->
        <div id="affiliation">              
            <?php include ("affAccess.php"); ?>             
        </div>  

Search.php 是用户输入电子邮件地址以查看它是否存在的地方。在搜索中,它会拉回 aff_id 并将其存储在会话变量中

sql="SELECT AFF_ID,LNAME, FNAME,EMAIL,ORG FROM AFFILIATE WHERE rtrim(EMAIL) LIKE '$s_email'";
$email_search = oci_parse($conn,$sql);
oci_define_by_name($email_search, 'ORG', $org);
oci_define_by_name($email_search, 'EMAIL', $e);
oci_define_by_name($email_search, 'FNAME', $fname);
oci_define_by_name($email_search, 'LNAME', $lname);
oci_define_by_name($email_search, 'AFF_ID', $affiliate);

$exec=oci_execute($email_search); 
oci_fetch($email_search);
$rows=oci_num_rows($email_search);
//$af=$affiliate;
$_SESSION['affiliate'] = $affiliate;

affAccess.php 还包括一个 addAccess.php。这是在单击更新时使用 affAccess.php 中的其他值更新数据库的地方。这是我的更新代码

if ($Update){
    $dept=rtrim($_POST['dept']);
    $campus=rtrim($_POST['campus']);
    $creat=rtrim($_POST['creat']);
    echo $_SESSION['affiliate'];    
    $sdate=isset($_REQUEST["s_date"])?$_REQUEST["s_date"]:"";
    $edate=isset($_REQUEST["e_date"])?$_REQUEST["e_date"]:"";
    echo "updating";    
    echo " dept is " . $dept;
    echo " campus is ". $campus;


    $sql = "BEGIN PassGen(); END;";
    $stmt = oci_parse($conn,$sql);
    $exec =oci_execute($stmt,OCI_DEFAULT);

    if (!$exec) {
        $e = oci_error($stmt);
        trigger_error(htmlentities($e['message']), E_USER_ERROR);
    }

    if ($exec) {

    } 
$sql="INSERT INTO AFFILIATIONS (AFF_ID, START_DATE,END_DATE,DEPT_ID,CAMP_ID, CREAT_ID, CREATED_TSTAMP, PASSWD)
            SELECT :AffID_bv, to_date(:SDate_bv, 'dd-Mm-yyyy'),to_date(:EDate_bv, 'dd-Mm-yyyy'),:DeptID_bv, :CampID_bv,:CreatID_bv, current_timestamp,'Zq'||dbms_random.string('A',4)||'$8' from dual";
    $stid = oci_parse($conn,$sql);

    //oci_bind_by_name($stid, ":AffID_bv", $_SESSION["affID"]);
    oci_bind_by_name($stid, ":AffID_bv", $_SESSION['affiliate']);
    oci_bind_by_name($stid, ":DeptID_bv", $dept);
    oci_bind_by_name($stid, ":CampID_bv", $campus);
    oci_bind_by_name($stid, ":CreatID_bv", $creat);
    oci_bind_by_name($stid, ":SDate_bv", $sdate);
    oci_bind_by_name($stid, ":EDate_bv", $edate);   

    $exec2 =oci_execute($stid,OCI_DEFAULT);

为了调试它,我在其他页面上回显它 echo $_SESSION['affiliate']。它正在选择它,但是当我单击更新时,$_SESSION['affiliate']它丢失了。

4

0 回答 0