I know this is probably super simple, but even Bing A.I. couldn’t figure it out. lol Basically, I need all the results from this query on separate lines. The code below works, but currently makes it a big mess and one after the other like a giant paragraph. I’m omitting the DB strings since that works, and it is correctly accessing the referenced tables.
Thanks!
$stmt = $pdo->prepare('SELECT email FROM odh_old WHERE email NOT IN (SELECT email FROM blood)');
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo $row['email'] . "\n";
}
print_r($row);
Your code is almost correct. You need to echo out the HTML break tag (<br> ) instead of "\n". Try this code
$stmt = $pdo->prepare('SELECT email FROM odh_old WHERE email NOT IN (SELECT email FROM blood)');
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo htmlspecialchars($row['email']) . "<br>";
}