Reputation: 165
i'm stuck with the following problem. I want to send a notificationmail when the field "notification" is checked.
So i use this code to see the status of the field "notification":
$request = "SELECT user_name, user_email FROM $table WHERE resourceId = $resourceId";
$result=mysqli_query($dbcon,$request);
while($row = mysqli_fetch_assoc($result)) {
$email=$row["user_email"];
$name=$row["user_name"];
$notification=$row["notification"];
};
I'm getting the correct results for $email and $name. But the field notification just stays empty. the notification field in de db is a boulean. (also tried with numeric fields, this also does not work)
What am i doing wrong?
kind regards,
Tim
Upvotes: 0
Views: 50
Reputation: 4491
Try this:
$request = "SELECT user_name, user_email, notification FROM $table WHERE resourceId = $resourceId";
$result=mysqli_query($dbcon,$request);
while($row = mysqli_fetch_assoc($result)) {
$email=$row["user_email"];
$name=$row["user_name"];
$notification=$row["notification"];
};
Upvotes: 1
Reputation: 12132
your SQL query needs to have the notification
field in the SELECT
clause:
SELECT user_name, user_email, notification FROM $table WHERE resourceId = $resourceId
Upvotes: 2