The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: passing recordset content to Session Variable

  1. #1

    passing recordset content to Session Variable

    hi Guys,
    Can any one tell me the correct way to pass recordset content to Session Variable? i have been try for many times,but still cannnot get it. Here is my script:

    <?php
    if (!session_id()) session_start();
    $_SESSION['Var'] = $row_Var_RS['Var_ID']?>

    Thanks

  2. #2
    please post your complete code...

    You can never underestimate the stupidity of the general public.

  3. #3
    Quote Originally Posted by RvGaTe View Post
    please post your complete code...
    Hi RvGaTe,


    Here is the code:


    <?php require_once('Connections/db_conn.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }
    }

    $colname_Var_RS = "-1";
    if (isset($_SESSION['kt_login_id'])) {
    $colname_Var_RS = (get_magic_quotes_gpc()) ? $_SESSION['kt_login_id'] : addslashes($_SESSION['kt_login_id']);
    }
    mysql_select_db($database_db_conn, $db_conn);
    $query_Var_RS = sprintf("SELECT * FROM login_tb WHERE ID = %s", GetSQLValueString($colname_Var_RS, "int"));
    $Var_RS = mysql_query($query_Var_RS, $db_conn) or die(mysql_error());
    $row_Var_RS = mysql_fetch_assoc($Var_RS);
    $totalRows_Var_RS = mysql_num_rows($Var_RS);
    ?>
    <?php
    if (!session_id()) session_start();
    $_SESSION['User_Email_SV'] = $row_Var_RS['Email']; ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta name="verify-v1" content="c1YO7f6F7gbqyIflhw3/mbQL2K4ImChdWo5K/SwHxJA=" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <p>Index.php</p>
    <p> <?php echo $_SESSION['User_Email_SV']; ?>
    </p>
    </body>
    </html>
    <?php
    ?>


    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012