Hi, can someone tell me how to store the arrays retrieved frm a database using sqlsrv_fetch_array to a variable? say for example this is my script:

echo $email;
$sql_int="SELECT item FROM Inventory WHERE user_email = '$email'";
$resultint = sqlsrv_query($conn,$sql_int);
$sql_loo="SELECT item FROM Looking WHERE user_email = '$email'";
$resultloo = sqlsrv_query($conn,$sql_loo);
print_r( sqlsrv_errors());
while($row_int = sqlsrv_fetch_array($resultint)){
echo $row_int['item'];
print_r( sqlsrv_errors());
}

$row_loo = array();
while($row_loo = sqlsrv_fetch_array($resultloo)){
echo $row_loo['item'];
print_r( sqlsrv_errors());

}

$row_loo = sqlsrv_fetch_array($resultloo);
echo $row_loo['item'];


$sql="SELECT user_email FROM Inventory WHERE item = '$row_loo'";
$resulmat = sqlsrv_query($conn,$sql);
print_r( sqlsrv_errors());

while($row = sqlsrv_fetch_array($resultmat)){
echo $row['user_email'];
print_r( sqlsrv_errors());


i am getting an error that says the underlined script, has null resource. I knw the problem is in the bold line. $row_loo doesnt have a value. The value is supposed to come frm the blue coloured lines. For some reason, it does echo the values, but outside of the loop the variable is empty. so i added another line ( the red one)outside the loop to fetch array values again, but its still not working. can someone help? I tried echoing some of the values to test and see if they are working by the ways.Thanks in advance. Still a newbie.
Oh by the way, the code is working fine up until the end of the blue lines. The problem with the script starts from the red lines to the bottom. I tried some many things, but its still nt working.