Forum Moderators: coopster
in this code I am tring to re-use an array pulled from a sql statment in a statment exicuted when the person selects an Anchor
the areas are defined with AS follows
// part1 sql pull array
// part1 sql pull array used first time$Result1
Part 2 Reusing the Array from part 1 here again $Result1
<?php
session_start();
@extract($_POST);
if (isset($_POST['action']) && $_POST['action'] == 'supporter_modify') {
require_once("../function.php");
// define each value from the post
$Category = stripslashes($Category);
$Supporter = stripslashes($NON);
If ($Supporter == 'on'){
$Supporter = "n";
} else {
$Supporter = "y";
}
$SQLstatment = "SELECT * FROM supporters WHERE Category='" .$Category. "' AND supporter='" .$Supporter. "' ORDER BY supportername ASC;";
Get_db_RS ($SQLstatment);
// part1 sql pull array
$Result1 = $_SESSION['result'];
// define table color alernates
$colour_odd = "#F2F3F3";
$colour_even = "#E5EFF6";
$row_count = 0; //To keep track of row number
$Mod_people = "
<div class=\"rightnavheaderblue\"><h3>PRESCRIPTION DRUG RE-IMPORTATION NON-SUPPORTERS</h3></div>
<div class=\"maincontent\">Click on the names below to modify their entries</div><br /><br />
<table>
";
// loop through the records and concatenate to NonList string
// part1 sql pull array used first time$Result1
while($row = mysql_fetch_array( $Result1 )) {
// Decide which colours to alternate for the rows
// If Remainder of $row_count divided by 2 == 0.
$row_color = (($row_count % 2) == 0)? $colour_even : $colour_odd;
// Print out the contents of each row into a table
$Mod_people .= "<tr><td bgcolor=\"" . $row_color . "\">
<a href=\"political_modify.php?personId=".$row['SupportId']."\" class=\"maincontent\" border=\"0\">".$row['SupporterName'].":</a><br>
</td></tr>";
$row_count++;
}
$Mod_people .= "
</table>
";
echo $Mod_people; // This contains a list of a people selected from the pulldown with a passed value of the persond Id tag
die;
}
if (!empty($_GET['personId'])){
//echo "pass"; // this is for first step testing
echo $_GET['personId'];
// Part 2 Reusing the Array from part 1 here again $Result1
while($row = global mysql_fetch_array( $Result1 )) {
echo $row['SupporterName'];
}
die;
// Next step is to use the passed variable in the url to present the person and info
}
?>
[edited by: jatar_k at 6:48 pm (utc) on Jan. 26, 2005]
[edit reason] fixed bb code [/edit]