How to move data inside the loop
Eg......
q = $db->prepare("SELECT id FROM table WHERE forename = :forename and surname = :surname LIMIT 1"); $q->bindValue(':forename', 'Joe'); $q->bindValue(':surname', 'Bloggs'); $q->execute(); if ($q->rowCount() > 0){ $check = $q->fetch(PDO::FETCH_ASSOC); $row_id = $check['id']; // do something }
I need to move $row_id ...
Eg......
q = $db->prepare("SELECT id FROM table WHERE forename = :forename and surname = :surname LIMIT 1"); $q->bindValue(':forename', 'Joe'); $q->bindValue(':surname', 'Bloggs'); $q->execute(); if ($q->rowCount() > 0){ $check = $q->fetch(PDO::FETCH_ASSOC); $row_id = $check['id']; // do something }
I need to move $row_id ...