PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 27th, 2012, 03:44 AM
Gaston Gaston is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 Gaston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 42 sec
Reputation Power: 0
PHP4 - Emailer

hi
i have a problem running a while loop in a emailer. i need to send the email a number of times. on the email is a voucher, each time one is created the barcode on each must change.

Reply With Quote
  #2  
Old November 27th, 2012, 04:04 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
Hi,

well, that's interesting, but what are we supposed to do now?

We're not psychic. We cannot magically find your problem based on a vague description of your script. If you want us to help, we need the actual code and a concrete error description (including any error message).

Reply With Quote
  #3  
Old November 27th, 2012, 04:16 AM
Gaston Gaston is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 Gaston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 42 sec
Reputation Power: 0
can i email the code to you? i cant post it here, it gives an message bout [php] and stuff.....

Reply With Quote
  #4  
Old November 27th, 2012, 04:30 AM
Gaston Gaston is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 Gaston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 42 sec
Reputation Power: 0
[PHP
include("a_connect.php");
$uid = (!empty($_GET['uid']))?$_GET['uid']:"";
$v = (!empty($_GET['v']))?$_GET['v']:"";



//switch($v){

//case "print":
//header("location:../generate-ticket3.php?uid=".$uid);
//break;
//case "email":

$i = 1;
$counter = $_POST["counter"]; // counter is set in the form, the page before coming to this page
while ($i <= $counter):

$row = row("select * from city_ticketsbought where bought_uid='$uid'");
$barcode = $row->bought_barcode;
$voucher = $row->bought_voucher;
$name = $row->bought_name;
$date = $row->bought_date;
$email = $row->bought_email;

$todaydate = date('d M Y');
$fromaddress = "email";
$Subject ="Voucher Confirmation";
$mailHeader = "From: " . $fromaddress;

$theMessage="";
$theMessage.="";

$theMessage.="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>City Sightseeing</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
$theMessage.="<style type=\"text/css\">";
$theMessage.="<!--";
$theMessage.="body, table, div, p {font-family: Arial, Helvetica, sans-serif;font-size:12px;}";
$theMessage.="-->";
$theMessage.="</style></head>";
$theMessage.="<body><table width=\"576\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
$theMessage.="<tr><td colspan=\"2\" style='background:#de011b;'><img src='".$theURL."images/city-sightseeing_icon.jpg' width='110' height='130' /><img src='".$theURL."images/city-sightseeing.gif' width='229' height='130' /></td>";
$theMessage.="</tr><tr>";
$theMessage.="<td valign=\"top\"><br>";
$theMessage.="<table width='576'><tr><td valign='top'><br><strong>Dear ".$name."</strong><br /></td><td align='right' width='200'>".$date ."<br>#".$barcode."<br>".$voucher."</td></tr>";
$theMessage.="</table>";
$theMessage.= "<br><a href='".$theURL."voucher.php?uid=".$uid."' target='_blank'>Print My Voucher</a><br /><br /><hr style=\"border-top:1px solid #000000;margin:10px 0px 10px 0px;\">";
$theMessage.="<div style=\"font-size:9px;line-height:10px;\"></div></td>";
$theMessage.="<td align=\"right\" valign=\"top\"></td>";
$theMessage.="</tr><tr><td colspan=\"2\" valign=\"top\"><br>";


$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$mailHeader.= "\nMIME-Version: 1.0\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n";


$toaddress = $email;
$ok = mail($toaddress, $Subject, $theMessage, $mailHeader);

$toaddress = "gaston@web2web.co.za";
$ck = mail($toaddress, $Subject, $theMessage, $mailHeader);



/**/

echo("<div style='margin:20px auto 0px auto;color:#FFF;font-family:arial;font-size:14px;text-align:center;padding:40px;width:700px;background:#ff0000'>The voucher email has been sent to $email</div>");

$i++;
endwhile;
]

Reply With Quote
  #5  
Old November 27th, 2012, 04:44 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
OK. And what's your question?

Reply With Quote
  #6  
Old November 27th, 2012, 04:48 AM
Gaston Gaston is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 Gaston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 42 sec
Reputation Power: 0
I have to loop this a number of times (the user must enter how many times). Then the form must print that amount of times. but the barcode after every loop should be different.

Reply With Quote
  #7  
Old November 27th, 2012, 05:06 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
Quote:
Originally Posted by Gaston
Then the form must print that amount of times.


So? Just print $_POST["counter"].

If you want to count the number of successful mails, use a separate counter that will only increment if $ok is true.



Quote:
Originally Posted by Gaston
but the barcode after every loop should be different.


Not sure what you're trying to do. As far as I can tell, the barcode comes from $row:
PHP Code:
 $row row("select * from city_ticketsbought where bought_uid='$uid'");
$barcode $row->bought_barcode

But you always select the same (random) row in each loop run, so the bar code is always the same.

If that's not what you want, then what do you want? You have multiple tickets (?) with each one having its own barcode, and you have a counter which is specified by the user. What is supposed to happen now?

Reply With Quote
  #8  
Old November 27th, 2012, 05:22 AM
Gaston Gaston is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 7 Gaston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 42 sec
Reputation Power: 0
i cant get it to send the email when i run the while loop. when i take the while out, it just send one email. i need it to send a number of times the user wants it to. the loop is not working at this moment

Reply With Quote
  #9  
Old November 27th, 2012, 05:43 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,863 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 19 h 44 m 40 sec
Reputation Power: 813
Quote:
Originally Posted by Gaston
the loop is not working at this moment


Um, and how were we supposed to know that?

Check if $_POST["counter"] is correct with var_dump($_POST) and reduce the loop to the absolute minimum (just do something like echo $i).

Also make sure you got your error_reporting turned on:
PHP Code:
 error_reporting(-1

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP4 - Emailer

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap