close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Trying to get a Session variable to equal a Recordset Value

Thread began 2/02/2010 12:20 am by ijk76319396 | Last modified 2/05/2010 5:40 pm by ijk76319396 | 3186 views | 8 replies

ijk76319396

I have been working on the solution and found that I needed to add row before the rsPAGEs so its now

<?php 
if(!session_id()) session_start();
$_SESSION['COMMID']=$row_rsPAGES['page_1'];
?>



If you go to web_comicxx.php?ID=6 you can see what I am trying to do. Now that I added that the echo works fine, it is the text directly under the "by Administrator" at the top of the page, however I am not concerned with displaying the text, rather I want to use the COMMID session value to filter the pages by comments in recordset4. So when someone enters a comment in the database the session value is entered into the applicable field, THIS WORKS as far as being entered correctly into the database, now the problem is with the recordset4 which I am trying to filter using the session variable of COMMID so the comment made should only show up on the page it was made on... however it's not working that way, it shows up sometimes on some pages, then not at all, sometimes I have to hit refresh to see anything. Any idea what could be causing this not to work? I am pasting the relevant code.

<?php $_SESSION['PAGEID']=$_GET['ID']; ?>
<?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;
}
}

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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO messages (username, subject, message, sender, senderID) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['hiddenField'], "text"),
GetSQLValueString($_POST['subject2'], "text"),
GetSQLValueString($_POST['message2'], "text"),
GetSQLValueString($_POST['SENDER'], "text"),
GetSQLValueString($_POST['SENDERID'], "text"));

mysql_select_db($database_con2com, $con2com);
$Result1 = mysql_query($insertSQL, $con2com) or die(mysql_error());

$insertGoTo = "../messagesent.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...