I have an array which I am getting from the following PDO:
$sqlQry = "SELECT Devices.dID FROM Friends LEFT OUTER JOIN Devices ON Friends.fID = Devices.dUID WHERE Devices.dID IS NOT NULL GROUP BY Devices.dID";
$db = getConnection();
$sth = $db->prepare($sqlQry);
$sth->execute();
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);
the array returns:
Array ( [0] => Array ([dID] => 2[0] => 2 ) [1] => Array ( [dID] => 3 [0] => 3 ))
For each one of the dID values I need to run an insert query that takes the dID and inserts it into a table in the same database with outer values.
$sqlIns = "INSERT INTO messages (dID, message, status") VALUES (?,?,?);
The message and status will be held in a variable
Can any one help me out with this one?