Using Session IDs to filter Recordset isn't looping through all of the IDs
I seem to be tripping over some basics here. Not sure what I am forgetting.
I am filtering a recordset from stored $_SESSION(s) BUT it's only filtering to the first ID of each $_SESSION.
Basically I have a 3 Step form that builds up ID's as they are selected and posted.
They are stored in $_SESSION(s,) one for each page.
The sessions are being stored ok as I move through each step.
By checking the final page using…
var_dump($_SESSION);
I get…
array(3) {
["Step_1"]=>
string(1) "5"
["Step_2"]=>
string(8) "51,13,20"
["Step_3"]=>
string(3) "2,6"
}
Recordset:
$ParamID_Recordset1 = "-1";
if (isset($_SESSION['Step_1'])) {
$ParamID_Recordset1 = $_SESSION['Step_1'];
}
$ParamID_Recordset1 = "-1";
if (isset($_SESSION['Step_2'])) {
$ParamID_Recordset1 = $_SESSION['Step_2'];
}
$ParamID_Recordset1 = "-1";
if (isset($_SESSION['Step_3'])) {
$ParamID_Recordset1 = $_SESSION['Step_3'];
}
mysql_select_db($database_dbProducts, $dbProducts);
$query_Recordset1 = sprintf("SELECT ProductID FROM tblProducts WHERE ProductID = %s OR ProductID = %s OR ProductID = %s", GetSQLValueString($ParamID_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $dbProducts) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
My results show only the first ID from each session, so obviously it's not looping through the entire session.
Do I need loop through all of the ids somehow? I figured the string in each session would do that?
Thanks,
TroyD