Hi there!
I have some script at the end of this php code to send an email. It is not working. I want to send it from the "course_email" from the subscriber's "email" with the subject the "course_desc" and the "first_name" and "last_name" in the body..
FYI:
"email", "first_name" and "last_name" are from one table and "course_email" and "course_desc" are from another table all in the same database.
Thank you for taking a look at this 🙂
Here is the code:
<?php
include ("password.inc") ;
mysql_connect ( $hostname, $dbuser, $dbpassword ) ;
mysql_select_db ($database) ;
$query = "select member_id , first_name , last_name , email , user_name, decode(password,'enc') , day_phone from member_corp_coach where type in ('P' , 'B') and user_name = '$user_name' and decode(password,'enc')='$password'" ;
$result = mysql_query ( $query) ;
$counter = 0 ;
while ( $row_array = mysql_fetch_row($result))
{
$person = $row_array[1] . " " . $row_array[2] ;
$counter = $counter+1 ;
break ;
}
if ( $counter == 0 ) {
header("Location:http://www.dare2feel.com/eclasses1.php");
exit ;
}
if( $course_desc1 != "" ) {
$query1 = "SELECT * FROM course WHERE '$course_desc1' = course_desc " ;
$result1 = mysql_query ( $query1 ) ;
if ( $result1 == 0 ) {
print ( mysql_error() );
exit;
}
$counter = 0;
while ( $row_array1 = mysql_fetch_row($result1))
{
$id= $row_array1[0];
$price = $row_array1[4] ;
$counter = $counter+1 ;
break ;
}
if ( $counter == 0 ) {
header("Location:http://www.dare2feel.com/eclasses1.php");
exit ;
}
$query = "INSERT INTO course_member ( course_id , member_id , course_reg_date,
member_type , total_amount )
VALUES ( '$id' , '$row_array[0]', sysdate(), 'P', '$price' )" ;
$result = mysql_query ($query) ;
if ( $result == 0 ) {
print ( mysql_error() );
}
}
if ( $course_desc1 == "" AND $course_desc2 == "" ) {
print ( " <BR> <BR> You have not selected any courses <br>" );
print("<A HREF=http://www.dare2feel.com/eclasses1.php >Click here to try again </A>");
exit ;
}
$query= "SELECT from member_corp_coach ( first_name, last_name,email)
values ( '$first_name', '$last_name', '$email')" ;
$query= "SELECT from course ( WHERE '$course_desc1' = course_desc, '$course_email1' = course_email)
values ( '$course_desc', '$course_email')" ;
$mailsend = mail( "$course_email" , "$course_desc", $body , "From: $email") ;
$body = "New Participant". $first_name . " " . $last_name . "\r\n";
?>