I am trying to generate an email to a user in a database. The database has the user's username as a column called "user" and their email address in a column called "email". When I submit a form, I have their username already because I am assigning a project to them. What I want to then do is search the database for their username and then grab their email address and assign it to the $email variable. Here is what I have so far but it will not output the email (I'm echoing for testing purposes):
Any help you can provide to get this to work how I would like it to is greatly appreciated.PHP Code://email the assigned person
global $database;
$q = "SELECT * FROM users WHERE username = $projectassigned";
$result = $database->query($q);
$row = $_GET['email'];
$email = $row['email'];
echo "<br /> Username: $projectassigned <br />";
echo "Email is: $email <br />";


Reply With Quote

Bookmarks