0
Good morning :D I need a light!
I need to take all 'ids' of users of a table and pass to another table, but when I give a foreach it returns me only 1 result as stdClass.
Follows 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;
Upshot:
stdClass Object
(
[usuario_id] => 7
)
I put die(); to close the script....
– Betinho Silva
But the focus is that I can’t get the user table id and put it in another table... row by row
– Betinho Silva