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.
so the dark red part does not echo success. and the green line echoes nothing, not even the willer. by teh way, when i echoed resultmat, it says smtg like resource id8#. so i am guessing that the resultmat does return a values as i am no longer getting any error that its null.
I check my databse many many times and i am very sure that there are datas that it shud match and display.
for some reason. the green part now is not echoing anything. thanks for the help so far, i cant believe i made such a silly error with the spelling but yeah now i have this new prob. will be grateful if you could help
// use the . to concatenate the expanded array element correctly into the sql string
$sql="SELECT user_email FROM Inventory WHERE item = '" . $row_loo[item]. "'";
// add a line of debug here - this is how you prove whether the sql statement is
// properly constructed - copy the output, paste it into your db, does it get results?
// does it show errors? RM it when when case is proven
echo $sql;
$resultmat = sqlsrv_query($conn,$sql);
if(sqlsrv_has_rows($resultmat)){
echo 'success';
}
}[/FONT]
So this basically stores the values from my query as $loo_email1,$loo_email2,$loo_email3 … This is bascially what i wanted. Anyways thanks guys.