Hey all,
I'm trying to access two variables $tableid and $itemindex which are set inside a while loop. When i echo it from the while loop i get the desired value, but when i echo them from outside the loop i don't get anything. Any suggestions? Thanks.
Here's the code:
while($row = mysql_fetch_array($result))
{
$tablename=$row['TableName'];
$result2=mysql_query("SELECT * FROM $tablename
WHERE ProductID='$productid' LIMIT 1");
if($result2)
{
$row2=mysql_fetch_assoc($result2);
$tableid=$row2['TableID'];
$itemindex=$row2['ItemIndex'];
echo "$tableid $itemindex";
}
}