I have a table1 with user-information and a table2 with posts made by the users. Sometimes (and only sometimes) it happens that a post is created in Table2 without the user's postal code. I need to find the posts where the ex postal code is missing and then update them with the postal code from table1. In both tables I can use 'email' for reference. The first part is easy with:
if ($stmt = $mysqli->prepare("SELECT` email` FROM `ads` WHERE` postal_code` = '0' ")) {
$stmt->execute();
$stmt->bind_result($email);
while($stmt->fetch())
{
// here I would like to do the postal code update, but it won't do
}
$stmt->close();
}
How do I get on with the second part of the project: updating the current record in Table2 "?