Jump to content


Photo

Passing session variable from Dreamweaver repeat region

repeat region

  • Please log in to reply
No replies to this topic

#1 upshire

upshire

    Newbie

  • New Members
  • Pip
  • 1 posts

Posted 15 January 2013 - 04:41 AM

Hi
I
'm using Dreamweaver CS6,My SQL and Php...
I am displaying a list of companies from a recordset on companies.php, then I place a link on the company id which takes me to company_details.php which displays that companies details, the recordset is filterd by a session variable 'vartest'. This works fine until I place the results on companies.php in to a repeat region, when I do this, the value of the session variable 'comp_id' remains equal to the id of the first record in the recordset no matter which record is clicked on.
How do I populate the session 'vartest' with the selected $rows id.
Any and all help appreciated..

David

P.S
I have posted the code of the page in question, showing the Dreamweaver recordset and the repeat region applied.


<?php require_once('Connections/connpay.php'); ?>
<?php session_start();?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}

$maxRows_rstest = 10;
$pageNum_rstest = 0;
if (isset($_GET['pageNum_rstest'])) {
$pageNum_rstest = $_GET['pageNum_rstest'];
}
$startRow_rstest = $pageNum_rstest * $maxRows_rstest;

mysql_select_db($database_connpay, $connpay);
$query_rstest = "SELECT * FROM db_company";
$query_limit_rstest = sprintf("%s LIMIT %d, %d", $query_rstest, $startRow_rstest, $maxRows_rstest);
$rstest = mysql_query($query_limit_rstest, $connpay) or die(mysql_error());
$row_rstest = mysql_fetch_assoc($rstest);

if (isset($_GET['totalRows_rstest'])) {
$totalRows_rstest = $_GET['totalRows_rstest'];
} else {
$all_rstest = mysql_query($query_rstest);
$totalRows_rstest = mysql_num_rows($all_rstest);
}
$totalPages_rstest = ceil($totalRows_rstest/$maxRows_rstest)-1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php do { ?>
<a href="test_result.php?<?php echo $_SESSION['vartest']; ?>=<?php echo $row_rstest['company_id']; ?>"><?php echo $row_rstest['company_id']; ?></a>
<?php } while ($row_rstest = mysql_fetch_assoc($rstest)); ?>
</body>
</html>
<?php
mysql_free_result($rstest);
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com