Good morning: D I need a light!
I need to get all the 'ids' of users from a table and move to another table, but when I give a foreach it returns only 1 result like stdClass.
Follow the code:
$stmt = $PDO->prepare("SELECT usuario_id FROM usuario WHERE nivel_usuario = 2");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_OBJ);
foreach ($result as $items):
echo "<pre>";
print_r($items);
echo "</pre>";
die();
endforeach;
Result:
stdClass Object
(
[usuario_id] => 7
)