Jump to content

rezbin

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by rezbin

  1. Hello, i am not good at php so need some help.I have a php page with check box from where i am trying to send mail to multiple recipient. i can send mail but with little problem. when i select eg. 3 check box to send email then 1st email recipient is ok but 2nd email goes with 1st and 2nd recipient and 3rd email goes 1st,2nd,3rd recipient. i guess having problem with 'foreach'. will someone pls help me to send individual email to individual recipient with my MySQL query's. Here is my code for mail.php page <?php require_once('auth.php'); ?> <html> <head> <title>PHPMailer - SMTP basic test with authentication</title> </head> <body> <?php include("Connections/connection.php"); //error_reporting(E_ALL); error_reporting(E_STRICT); date_default_timezone_set('Europe/Dublin'); require_once('php_mailer/class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail = new PHPMailer(); //$body = file_get_contents('contents.php'); //$body = eregi_replace("[\]",'',$body); $sender_name = $_SESSION['sender_name']; $sender_email = $_SESSION['sender_email']; $sender_password = $_SESSION['sender_password']; $id_user = $_POST["id_user"]; foreach ($id_tariff as $idt) { $query = sprintf("SELECT From_Date, To_Date, first, last, city, country, Email_1, Email_2, account_name FROM user_info where id_user = $id_user"); $result = mysql_query($query) or die(mysql_error()); $body = " <table width='100%' border='1' cellspacing='0' cellpadding='3' bordercolor='#ffcccc'> <tr> <th bgcolor='#cc3333'>From</th> <th bgcolor='#cc3333'>To</th> <th bgcolor='#cc3333'>First Name</th> <th bgcolor='#cc3333'>Last Name</th> <th bgcolor='#cc3333'>City</th> <th bgcolor='#cc3333'>country</th> </tr> "; while($row = mysql_fetch_array($result)){ $body .="<tr>"; $body .="<td>".$row['From_Date']."</td>"; $body .="<td bgcolor='#FFE8E8'>".$row['To_Date']."</td>"; $body .="<td>".$row['first']."</td>"; $body .="<td bgcolor='#FFE8E8'>".$row['last']."</td>"; $body .="<td>".$row['city']."</td>"; $body .="<td bgcolor='#FFE8E8'>".$row['country']."</td>"; $body .="</tr>"; $to1 = $row['Email_1']; $to2 = $row['Email_2']; $account_name = $row['account_name']; } $body .="</table>"; $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.gmail.com"; // SMTP server $mail->SMTPDebug = 1; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth = true; // enable SMTP authentication $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; // sets the SMTP server $mail->Port = 465; // set the SMTP port for the GMAIL server $mail->Username = "$sender_email"; // SMTP account username $mail->Password = "$sender_password"; // SMTP account password $mail->SetFrom($sender_email,$sender_name); $mail->AddReplyTo("$sender_email","$sender_name"); $mail->Subject = "Hello Dear $account_name"; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; $mail->MsgHTML($body); $mail->AddAddress($to1,$account_name); $mail->AddAddress($to2,$account_name); if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "YOUR E-MAIL HAS SENT"; } } ?> </body> </html> Thanks in advance.
  2. Dear mikosiko, Thank you very much. it works now. really appreciating help.
  3. Hello Mikosilko, Thank u for you quick response. having problem with ur code. error showing "Unknown column 'b.fetcha' in 'on clause'"
  4. Hello Mikosiko, Here is my Query's received from one great. and only resolved half of problem select employee.name, ifnull(done,0) done,ifnull(failed,0) failed,ifnull(score,0) score from employee left join (select emp_id,sum(job_done) done,avg(score) score from job_done group by emp_id) done using(emp_id) left join (select emp_id, sum(job_failed) failed from job_failed group by emp_id) failed using(emp_id) order by employee.name; Here im unable to add sum of done+failed = total, done/total*100= xx%. and finally combine both date in a single column so that i can search by date. can you please give some code to finish it? Thanks
  5. Hi mikosiko, this table layout was created and used by a software so i cant do that.i know this would be better. please help to get the 2nd option.
  6. Hi, can anyone show me the procedure to make this happen, i am new on this. emp_id--Name 1-------AA 2-------AB 3-------AC 4-------AD 5-------AE 6-------AF 7-------AZ 2)table job_done emp_id --- date - --job_done --score 1 - - - 22-06-2011 -------1-------50 3 - - - 23-06-2011--------1-------25 5 - - - 24-06-2011--------1-------70 1 - - - 25-06-2011--------1-------50 3 - - - 26-06-2011--------1-------25 3)table job_failed emp_id - -- date -- job_failed 2 - - - 22-06-2011 -------1 4 - - - 24-06-2011 -------1 6 - - - 26-06-2011 -------1 5 - - - 21-06-2011 -------1 Now how can i get result like Name - -job_done - job_failed -score - job_handled - success_rate AA---------2----------0----------50-------- 2 -----------100% AB---------0----------1----------0 -------- 1 ----------- 0% AC---------2----------0----------25-------- 2 -----------100% AD---------0----------1----------0 -------- 1 ----------- 0% AE---------1----------1----------70-------- 2 ----------- 50% AF---------0----------1----------0 -------- 1 ----------- 0% 1)here date will not visible but i must able to search by date from both job_done and failed date by one selected range but i'm only can manage with one date either table 2 or 3 . 2)if a employee like 'AZ' not give any job will exclude from report.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.