Nevermind, I was able to figure it out. I wrote this code to make it happen:
$sql = "SELECT email FROM agent WHERE access_code = $access_code";
$result = @mysql_query($sql, $connection) or die("Couldn't execute query.");
$row = mysql_result($result, $m, 'email');
$agent_mail = "$first_name $last_name has just viewed your presentation, they can be reached at $phone or you can email them at $email, they want info on $product";
$header = "From:
email@email.com";
$subject = "Someone Viewed your presentation";
mail("$row","$subject","$agent_mail","$header");
probably not the prettiest code but it works, and I'm still learning.
-AaronN