close ad
 
Important WebAssist Announcement
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/01/2010 9:20 pm by ijk76319396 | Last modified 2/05/2010 2:40 pm by ijk76319396 | 5683 views | 8 replies

ijk76319396

Had to post the remaining php down here because it was too long...

$colname_Recordset1 = "-1";
if (isset($_SESSION['PAGEID'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_SESSION['PAGEID'] : addslashes($_SESSION['PAGEID']);
}
mysql_select_db($database_con2com, $con2com);
$query_Recordset1 = sprintf("SELECT * FROM members WHERE ID = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $con2com) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);



mysql_select_db($database_con2com, $con2com);
$query_Recordset3 = "SELECT ID FROM members ORDER BY ID DESC";
$Recordset3 = mysql_query($query_Recordset3, $con2com) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);

$maxRows_Recordset4 = 10;
$pageNum_Recordset4 = 0;
if (isset($_GET['pageNum_Recordset4'])) {
$pageNum_Recordset4 = $_GET['pageNum_Recordset4'];
}
$startRow_Recordset4 = $pageNum_Recordset4 * $maxRows_Recordset4;

$colname_Recordset4 = "-1";
if (isset($_SESSION['COMMID'])) {
$colname_Recordset4 = (get_magic_quotes_gpc()) ? $_SESSION['COMMID'] : addslashes($_SESSION['COMMID']);
}
mysql_select_db($database_con2com, $con2com);
$query_Recordset4 = sprintf("SELECT * FROM comments WHERE pageID = %s ORDER BY ID DESC", GetSQLValueString($colname_Recordset4, "text"));
$query_limit_Recordset4 = sprintf("%s LIMIT %d, %d", $query_Recordset4, $startRow_Recordset4, $maxRows_Recordset4);
$Recordset4 = mysql_query($query_limit_Recordset4, $con2com) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);

if (isset($_GET['totalRows_Recordset4'])) {
$totalRows_Recordset4 = $_GET['totalRows_Recordset4'];
} else {
$all_Recordset4 = mysql_query($query_Recordset4);
$totalRows_Recordset4 = mysql_num_rows($all_Recordset4);
}
$totalPages_Recordset4 = ceil($totalRows_Recordset4/$maxRows_Recordset4)-1;

mysql_select_db($database_con2com, $con2com);
$query_rsVALIDATOR = "SELECT ID FROM comments ORDER BY ID DESC";
$rsVALIDATOR = mysql_query($query_rsVALIDATOR, $con2com) or die(mysql_error());
$row_rsVALIDATOR = mysql_fetch_assoc($rsVALIDATOR);
$totalRows_rsVALIDATOR = mysql_num_rows($rsVALIDATOR);

$maxRows_rsPAGES = 1;
$pageNum_rsPAGES = 0;
if (isset($_GET['pageNum_rsPAGES'])) {
$pageNum_rsPAGES = $_GET['pageNum_rsPAGES'];
}
$startRow_rsPAGES = $pageNum_rsPAGES * $maxRows_rsPAGES;

$colname_rsPAGES = "-1";
if (isset($_SESSION['PAGEID'])) {
$colname_rsPAGES = (get_magic_quotes_gpc()) ? $_SESSION['PAGEID'] : addslashes($_SESSION['PAGEID']);
}
mysql_select_db($database_con2com, $con2com);
$query_rsPAGES = sprintf("SELECT * FROM uploads WHERE ID = %s ORDER BY message_id DESC", GetSQLValueString($colname_rsPAGES, "text"));
$query_limit_rsPAGES = sprintf("%s LIMIT %d, %d", $query_rsPAGES, $startRow_rsPAGES, $maxRows_rsPAGES);
$rsPAGES = mysql_query($query_limit_rsPAGES, $con2com) or die(mysql_error());
$row_rsPAGES = mysql_fetch_assoc($rsPAGES);

if (isset($_GET['totalRows_rsPAGES'])) {
$totalRows_rsPAGES = $_GET['totalRows_rsPAGES'];
} else {
$all_rsPAGES = mysql_query($query_rsPAGES);
$totalRows_rsPAGES = mysql_num_rows($all_rsPAGES);
}
$totalPages_rsPAGES = ceil($totalRows_rsPAGES/$maxRows_rsPAGES)-1;

$colname_rsRATINGS = "-1";
if (isset($_SESSION['PAGEID'])) {
$colname_rsRATINGS = (get_magic_quotes_gpc()) ? $_SESSION['PAGEID'] : addslashes($_SESSION['PAGEID']);
}
mysql_select_db($database_con2com, $con2com);
$query_rsRATINGS = sprintf("SELECT * FROM rating WHERE ARTISTusername = %s ORDER BY rating DESC", GetSQLValueString($colname_rsRATINGS, "text"));
$rsRATINGS = mysql_query($query_rsRATINGS, $con2com) or die(mysql_error());
$row_rsRATINGS = mysql_fetch_assoc($rsRATINGS);
$totalRows_rsRATINGS = mysql_num_rows($rsRATINGS);

$colname_rsAVGRATING = "-1";
if (isset($_SESSION['PAGEID'])) {
$colname_rsAVGRATING = (get_magic_quotes_gpc()) ? $_SESSION['PAGEID'] : addslashes($_SESSION['PAGEID']);
}
mysql_select_db($database_con2com, $con2com);
$query_rsAVGRATING = sprintf("SELECT FORMAT(AVG(rating), 2) AS averageRating FROM rating WHERE ARTISTusername = %s", GetSQLValueString($colname_rsAVGRATING, "int"));
$rsAVGRATING = mysql_query($query_rsAVGRATING, $con2com) or die(mysql_error());
$row_rsAVGRATING = mysql_fetch_assoc($rsAVGRATING);
$totalRows_rsAVGRATING = mysql_num_rows($rsAVGRATING);

mysql_select_db($database_con2com, $con2com);
$query_rsADMIN = "SELECT * FROM adminstuff";
$rsADMIN = mysql_query($query_rsADMIN, $con2com) or die(mysql_error());
$row_rsADMIN = mysql_fetch_assoc($rsADMIN);
$totalRows_rsADMIN = mysql_num_rows($rsADMIN);

$colname_rsSCORE = "-1";
if (isset($_SESSION['PAGEID'])) {
$colname_rsSCORE = (get_magic_quotes_gpc()) ? $_SESSION['PAGEID'] : addslashes($_SESSION['PAGEID']);
}
mysql_select_db($database_con2com, $con2com);
$query_rsSCORE = sprintf("SELECT SUM(points) AS sumScore FROM combinedscore WHERE userID = %s", GetSQLValueString($colname_rsSCORE, "text"));
$rsSCORE = mysql_query($query_rsSCORE, $con2com) or die(mysql_error());
$row_rsSCORE = mysql_fetch_assoc($rsSCORE);
$totalRows_rsSCORE = mysql_num_rows($rsSCORE);

$colname_rsSUB = "-1";
if (isset($_SESSION['PAGEID'])) {
$colname_rsSUB = (get_magic_quotes_gpc()) ? $_SESSION['PAGEID'] : addslashes($_SESSION['PAGEID']);
}
mysql_select_db($database_con2com, $con2com);
$query_rsSUB = sprintf("SELECT * FROM subscribe WHERE SUBEEID = %s", GetSQLValueString($colname_rsSUB, "text"));
$rsSUB = mysql_query($query_rsSUB, $con2com) or die(mysql_error());
$row_rsSUB = mysql_fetch_assoc($rsSUB);
$totalRows_rsSUB = mysql_num_rows($rsSUB);

$queryString_Recordset4 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset4") == false &&
stristr($param, "totalRows_Recordset4") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset4 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset4 = sprintf("&totalRows_Recordset4=%d%s", $totalRows_Recordset4, $queryString_Recordset4);

$queryString_rsPAGES = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsPAGES") == false &&
stristr($param, "totalRows_rsPAGES") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsPAGES = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsPAGES = sprintf("&totalRows_rsPAGES=%d%s", $totalRows_rsPAGES, $queryString_rsPAGES);
?><?php
if(!session_id()) session_start();
$_SESSION['COMMID']=$row_rsPAGES['page_1'];
?>

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...