Fetching data to get array of ids i need
$STH = $DBH->prepare("SELECT char_id FROM att WHERE raid_id=:id AND spec=:spec AND status=:status");
$STH->bindValue(":id", $id);
$STH->bindValue(":spec", $curr_spec);
$STH->bindValue(":status", $curr_status);
$STH->setFetchMode(PDO::FETCH_ASSOC);
$STH->execute();
$temp1 = $STH->fetchAll();
This code works perfectly. It returns correct values.
$temporary =$temp1[0]["char_id"];
echo $temporary;
But when i try to get values from array in this for loop it returns nothing in echo.
for($i=0; $i < 2; $i++)
{
$tempor =$temp1[i]["char_id"];
echo $tempor;
//...
}
I've spent a lot of time, but I couldn't solve it myself. If possible, please help me.
echo $temporary
andfor
statement? – DontVoteMeDown Jun 10 '13 at 14:31