Mr Blue Mr Blue - 6 months ago 12x
SQL Question

How to echo row from custom statement another than $stmt

My code :

$stmt = $user_home->runQuery("SELECT * FROM tbl_users, tbl_products WHERE userID=:uid and creatorID=:uid");
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$scheck = $user_home->runQuery("SELECT * FROM tbl_products WHERE serialNumber=:snr");

How to echo row from $scheck?

When I type
it's showing row from $stmt.

I try to do
but it does not show anything.

I tried to find answer in google, but I did not find the solution.


When you are already using fetch on another statement above, why cant you use it here too?

$scheckrow = $scheck->fetch(PDO::FETCH_ASSOC);

Then you can simply do what you're already doing

echo $scheckrow['artNumber'];