Hello I'm a beginner in php, MySQL, and html and I'm trying to use the MySQL database to send an email from php. I have the user enter whether they want an email receipt on an HTML page, they enter "Y" if they do. If they say yes then I use their primary key to grab their email address from the database (They can only use this form if they already exist in the database). Once I do this I try to use the query result in the mail() function in php.
The query is:
$s = "select mail from AA where UCID = '$UCID'";
I run and store the result:
($t = mysqli_query( $db, $s )) or die ("<br>SQL Error: " . mysqli_error($db) );
I then try to send the email:
mail($t, "Your Recent Transaction", "Test");
When I run the code I get this error in my html file:
Warning: mail() expects parameter 1 to be string, object given in /afs/cad.njit.edu/u/h/k/hk363/public_html/download/depositORwithdraw.php on line 54
I tried surrounding $t in quotes ("$t") but that didn't seem to work either, any solutions?
Thank You!