Help with newsletter PHP Mail script for mySQL / cron

I'm just trying to set up a PHP script to send emails as a cron job.

It's pretty much seems to work, but I can't do both.

The first part is to send emails, and the second is to send a notification by e-mail to the owner of the site, confirming that the emails have been sent.

The script looks like:

------------------

<? PHP

include_once "connect_to_mysql.php";

$sql = mysql_query ("SELECT name user, E-mail"), Newsletter_Received from users WHERE Firstname = 'test' LIMIT 20;

$numRows = mysql_num_rows ($sql);

$mail_body = ";

While ($row = {mysql_fetch_array ($sql))}

$id = $row ['UserID'];

$email = $row ['email'];

$name = $row ["Firstname"];

$mail_body = ' test - please ignore ';

$subject = 'safari price Newsletter. "

$headers = "from: ". " [email protected] \r\n";

$headers. = "content-type: text/html\r\n";

$to = "$email";

$mail_result = mail ($ $subject, $mail_body, $headers);

If {($mail_result)

mysql_query ("UPDATE users SET Newsletter_Received = '1' WHERE Email = '$email' LIMIT 20");

} else {}

}

}

? >

<? PHP

If ($numRows == 0) {}

$subj = sent "Newsletter."

$body = "news bulletin was sent to everyone.';

$hdr = "from: ". " [email protected] \r\n";

$hdr. = "content-type: text/html\r\n";

mail ("[email protected]", $subj, $body, $hdr);

}

? >

--------------

Essentially with the line

include_once "connect_to_mysql.php";

included, it sends the emails according to the SELECT query, but don't send email «Sent Newsletter»

But if I take this line, of course, it does not send e-mails under the SELECT query, but it sends the email "Newsletter sent.

Any suggestions on what might need to change for him to do both would be much appreciated!

Thank you.

Change this line-

If ($numRows == 0) {}

on this subject.

If {($mail_result)

Tags: Dreamweaver

Similar Questions

  • Need help with the launching track pack for forza code 4

    Bought new Forza 4 and the lancer Track Pack code does not work, how do I get a code that is generated in the form I've already paid for it. Rank of loads of numbers and sent 10 s of emails but cant seem to get help.

    This is the help I get when the cat to an Ambassador xbox on xbox.com

    Terry wrote:
    Need help with the launching track pack for forza code 4
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Location of Ambassador of the community...
    The Xbox Ambassador says:
    Your question will be answered by an Ambassador of the Xbox. You have been connected to the Ambassador as a user Xbox [3]
    The Xbox Ambassador says:
    Hello
    Terry wrote:
    Hello
    The Xbox Ambassador says:
    Hey
    Terry wrote:
    just to be on the phone to xbox live support and was told to come here
    The Xbox Ambassador says:
    ok\
    The Xbox Ambassador says:
    What is your problem?
    Terry wrote:
    I bought the 4 for forza ansd 360 new sealed Christmas...
    Terry wrote:
    has got 2 codes that accompanies the game but the pack track code does not work
    The Xbox Ambassador says:
    Wow good
    Terry wrote:
    whenever I put in the code it says code redeemed
    The Xbox Ambassador says:
    I think the code is used. You must return to the retailer
    Terry wrote:
    I tried to, but since I already opened the case they will not accept
    The Xbox Ambassador says:
    Oh. No,
    Terry wrote:
    the code had been used or defective as I am the only person who has touched the game once opened, tried to enter the code when it is open
    The Xbox Ambassador says:
    Maybe it was auto bought?
    Terry wrote:
    so, how do I get another code generated track Pack if defective?
    The Xbox Ambassador says:
    I do not know.
    Terry wrote:
    bought the game new, so I get the track pack
    The Xbox Ambassador says:
    Oh. It's bad.
    The Xbox Ambassador says:
    I think that if you Exchange 1 code it will buy it
    Terry wrote:
    car pack code worked, starter pack did not work
    The Xbox Ambassador says:
    Oh.
    The Xbox Ambassador says:
    It's a bad
    The Xbox Ambassador says:
    BTW you have an evolution of the tests?
    Terry wrote:
    Yes, I want to? but more anxious to get a code object generated for this pack
    The Xbox Ambassador says:
    Hey if I help can u give me this game too?
    Terry wrote:
    ?????????????????
    Terry wrote:
    So is it possible to get a code for that time?
    The Xbox Ambassador says:
    Hey
    The Xbox Ambassador says:
    Yes.
    The Xbox Ambassador says:
    you need to contact them
    The Xbox Ambassador says:
    and tell them that the code is used.
    Terry wrote:
    I was told to come here? where can I go to get the code?

    Hi Terryg76,

    ·         What version of the operating system is installed on the computer?

    I suggest you to contact the game manufacturer for more help and information.

  • Need help with Windows Live Mail password

    Microsoft support told me that the only way to get help with my last password is by e-mail or forums and I recorded many positions and got no response.  I gave them all of my personal info to my email account and no response. I called in and no response.  Should I give up on this account?  I got it for more than three years and many court and legal emails were sent there I need.  Please notify.

    I guess that you have a Live account Windows that you do not manage to connect to for various reasons.  Can clarify you what the case, and you can specify that you forgot your password or your user name?

    If you talk about this type of Forums (below) then they are very busy, but eventually you should get a response from Microsoft.  If the problem is that I'm guessing that this is so only Microsoft can fix the problem for you, posters not Microsoft, as we find in this Forum won't be able to do much for you other than to advice on a course of action to follow.

    Reset your password
    https://help.live.com/help.aspx?mkt=en-AU&project=liveidv1&format=B2&QueryType=keyword&query=QAF

    Support e-mail for Windows Live ID.
    https://support.live.com/eForm.aspx?ProductKey=WLID&CT=eformts&b56fbf12-3dcf-4c16-9E21-25f9e35ffe3d&mapquerytype=keyword&mapquery=QAF

    If I remember the way Microsoft handle such problems with the "lockout", it's that they contact you by E-mail (an address that you can still access) and either reset your password or clear the problem after having proved to their satisfaction that you are the owner of the blocked account.  The process is a lot easier if you have (in the setup) provided them with another email address, or installed (and remember) secret an answer to the Question.

    Unfortunately, the whole process may fail and you may forever lose this account.  If that were the case, you should start now to try to get duplicates of important emails from the original sender.

  • Help with a date field script

    Sorry if this is a repeat. I was interrupted and found that my browser crashed when I'm new so I don't know if the question arises.

    I need a script for a date (mm/dd/yyyy) field where the user can fill only a date that is between 12/31/1899 and the current date (no matter what the date when the form is open). I'm getting to write this but I could not with this one. Any help would be greatly appreciated.

    Thank you!

    I have a feeling that I already answered this question some time ago... Anyway, you can use this code as a script custom validation of the field:

    var minDate = util.scand("mm/dd/yyyy", "12/31/1899");
    var maxDate = new Date();
    event.rc = true;
    if (event.value) {
        var d = util.scand("mm/dd/yyyy", event.value);
        if (dmaxDate) {
            app.alert("Error! The entered date must be between " + util.printd("mm/dd/yyyy", minDate) + " and " + util.printd("mm/dd/yyyy", maxDate));
            event.rc = false;
        }
    }
    
  • Can someone help me to write a script for Soundbooth

    If I have 50 files in C:\MyMusic and you want to

    Game Volume in Soundbooth CS5 how can I write a script for this?

    The only other way that I saw him do this with a library of that size is by Steve DeKorte SoundConverter. It would be tedious to do, but there is a feature to "normalize volume" on all files being converted. E than another inconvenience is that as long as you "convert" MP3 to MP3, you must save the files "converted" to a different directory. It won't crush during the standardization process.

    I had a library of more than 92 000 songs in 14 000 folders and subfolders 46 000 until last October. I had been there twice to "clean up and mormalize ' it more than six years." The transport entered on the drive that I was preparing to back up everything on DVD, and I have been unable to recover the data on the disks when it happened. I was duly upset when I lost all this music, but as I look back over the last eight months, I had a lot less worries ' tinkering ' with all these files all the time.

  • Problem with sending data to the Php Mail Script.

    So, I work with this Flash pattern that my boss bought. It has a contact form, you are supposed to be able to fill, and he sent an e-mail to a specified address.

    However, it does not work. Not at all!

    There are 4 fields on the form

    name

    E-mail

    Phone

    Message

    The Code for the button send is

    -Code button-

    onClipEvent (load) {this.t.v = _root.contacts_txt7 ;}

    on (rollover) {this.gotoAndPlay ("s1") ;}

    (deployment) {this.gotoAndPlay ("s2") ;}

    {We (Release)}

    _parent.loadVariables ("inc/mail.php", "POST");

    }

    -Code button-

    The php script is

    Php script-

    <?

    $name = $_POST ['name'];

    $email = $_POST ['email'];

    $phone = $_POST ['phone'];

    $message = $_POST ['message'];

    $ToEmail = "email@here";

    $ToSubject = 'the message of your site;

    $EmailBody = "name: $name\n".

    E-mail: $email\n

    Phone: $phone\n

    "Message: $messages\n";

    $Message = $EmailBody;

    $headers. = "content-type: text; charset = iso-8859-1\r\n ";

    $headers. = « de : ". $nom. « / ». $email. » \r\n » ;

    mail ($ToEmail, $ToSubject, $Message, $headers);

    ? >

    Php script-

    It seems like it should work. The mail on the server function works, as I am able to set up a base in php contact page and it works, however, he wants that this flash contact form. It's as if the flash does not send anything to the php script. Is there something missing? I have looked for hours and have resorted to hitting my head on the wall, in an effort to jar loose ideas, so far, nothing.

    1. don't set the $ToEmail variable

    2. I do not see where $headers is initialized

    3. what directory (relative to the html embed your swf) contains mail.php and

    4. use tracking feature to ensure that these variables (name, etc.) are set to _parent when your php file is called.

  • Need help with the debugging of flash for survey email form script!

    Hi all

    I have a survey form .fla file I adapted a fedback form work. They use .asp to compile and send an email, but I can't work on why the survey form does not work. Anyone would be able to run on this script and tell me if there is anything wrong with it. I've been going on it again and again, but can not see something wrong!

    Question1. Text = question2.text = question3.text = question4.text = question5.text = question6.text = question7a.text = question7b.text = question7c.text = question7d.text = question7e.text = question7f.text = contact_message.text = age.text = business.text = contact_email.text = message_status.text = "";

    send_button.addEventListener (MouseEvent.Click, Submit);

    reset_button.addEventListener (MouseEvent.CLICK, reset);

    System.security.allowDomain ("localhost");

    var: timer;

    var var_load:URLLoader = new URLLoader;

    var URL_request:URLRequest = new URLRequest("mail.asp");

    URL_request. Method = URLRequestMethod.POST;

    function submit(e:MouseEvent):void

    {

    If (question1.text == "" |) Question2.text == ' | Question3. Text == ' | question4. Text == ' | question5. Text == ' | question6. Text == ' |          question7a. Text == ' | question7b. Text == ' | question7c. Text == ' | question7d. Text == ' | question7e. Text == ' | question7f. Text == ' | contact_message. Text == ' | Age.Text == ' | "Business.Text == ' | contact_email. Text == "")

    {

    MESSAGE_ERROR. Text = "* fill all fields!";

    }

    else if (! validate_email (contact_email.text))

    {

    MESSAGE_ERROR. Text = "* Invalid Email!";

    }

    on the other

    {

    MESSAGE_ERROR. Text = "";

    message_status. Text = "Send"... » ;

    var email_data:String = '& question1 =' + question1.text

    + '& question2 =' + question2.text

    + '& question3 =' + question3.text

    + '& question4 =' + question4.text

    + '& question5 =' + question5.text

    + '& question6 =' + question6.text

    + '& question7a =' + question7a.text

    + '& question7b =' + question7b.text

    + '& question7c =' + question7c.text

    + '& question7d =' + question7d.text

    + '& question7e =' + question7e.text

    + '& question7f =' + question7f.text

    + '& message =' + contact_message.text

    + "& age =" + age.text

    + ' & company = "+ business.text

    + '& email =' + contact_email.text;

    var URL_vars:URLVariables = new URLVariables (email_data);

    URL_vars. DataFormat = URLLoaderDataFormat.TEXT;

    URL_request. Data = URL_vars;

    var_load. Load (URL_request);

    var_load.addEventListener (Event.COMPLETE, receive_response);

    }

    }

    function reset(e:MouseEvent):void

    {

    Question1. Text = question2.text = question3.text = question4.text = question5.text = question6.text = question7a.text = question7b.text = question7c.text = question7d.text = question7e.text = question7f.text = contact_message.text = age.text = business.text = contact_email.text = message_status.text = "";

    }

    function validate_email(s:String):Boolean

    {

    var p:RegExp = /(\w|[_.\-])+@((\w|-)+\.) + \w{2,4} +;

    var r: Object = p.exec (s);

    If (r is nothing)

    {

    Returns false;

    }

    Returns true;

    }

    function receive_response(e:Event):void

    {

    var loader: URLLoader = URLLoader (e.target);

    var email_status = new URLVariables (loader.data) .resposta;

    If (email_status is "Yes")

    {

    message_status. Text = "thank you for your comments. We will be in touch shortly. « ;

    Timer = new Timer (500);

    timer.addEventListener (TimerEvent.TIMER, on_timer);

    Timer.Start ();

    }

    on the other

    {

    MESSAGE_ERROR. Text = "Message send didn t!"

    }

    }

    function on_timer(te:TimerEvent):void

    {

    If (timer.currentCount > = 5)

    {

    Question1. Text = question2.text = question3.text = question4.text = question5.text = question6.text = question7a.text = question7b.text = question7c.text = question7d.text = question7e.text = question7f.text = contact_message.text = age.text = business.text = contact_email.text = message_status.text = "";

    timer.removeEventListener (TimerEvent.TIMER, on_timer);

    }

    }

    Thanks in advance.

    J

    your string is incorrect.  use:

    var email_data:String = '? '. Question1 ="+ question1.text

    + '& question2 =' + question2.text

    + '& question3 =' + question3.text

    + '& question4 =' + question4.text

    + '& question5 =' + question5.text

    + '& question6 =' + question6.text

    + '& question7a =' + question7a.text

    + '& question7b =' + question7b.text

    + '& question7c =' + question7c.text

    + '& question7d =' + question7d.text

    + '& question7e =' + question7e.text

    + '& question7f =' + question7f.text

    + '& message =' + contact_message.text

    + "& age =" + age.text

    + "& business =" + business.text

    + '& email =' + contact_email.text;

  • Help with windows live mail!

    I use windows live mail. I'm having problems with it and have no idea why these problems started. I just bought this PC 3 months and am the only user. I've uninstalled and reinstalled windows live. I receive e-mail, but get an error message when I try to reply or forward. Also a UAC window appears whenever I try to open windows live mail. I get message UAC asking you "do you want to allow the following program to make changes to this computer" so firstly why would I be able to receive emails, but cannot send, second - what is the program trying to change every time I open it?, and how do I prevent this arise? I tried to change all settings in the user account controls, but the message still appears everytime I open windows live mail.

    Hi mulani,.

    The best place to ask your question of Windows Live is inside Windows Live help forums. The experts he specialize in all things, Windows Live and I would be happy to help you with your questions! Please choose a product below to be redirected to the appropriate community:

    Windows Live Mail

    Windows Live Hotmail

    Looking for a different product to Windows Live? Visit the home page Windows Live Help for the complete list of Windows Live forums at www.windowslivehelp.com.

  • Need help with a basic host script?

    All I recently started using Powershell scripts and as big a language it is that I'm still learning at the 'very' early stages. All I would do is create a script that reads some hosts from a text file, and then it receives some info on all the virtual machines associated with this host. I know that the get - vm command can do for ALL the virtual machines in VC but when I run my script it seems to get the information for the VC together and NOT on a per-host basis. (We have several hosts within the domain and require info VM only a couple). Ive checked some samples but nothing that allows me to get the info I need Heres my script so far (very basic, I know!)  $hostlist = (get-vmhost-name (get-content c:\hosts.txt) | select name) #Get VMs for each host foreach ($esx in $hostlist) {$VMs = get - vm foreach ($vm in $VMs) {Write-host $vm. Write-host $vm name. $vm.numcpu MemoryMB Write-host Write-host $vm. Guest}} I know its really basic so far, but all I'm trying to achieve is just get some info on some VMS and report to the console (I know that I can send the information to a spreadsheet myself so now worries it) thank you very much for you help in advance

    You can limit the virtual machines, you receive chaining cmdlets Get-VmHost and Get - Vm together like this

    $hostlist = (get-vmhost -Name (get-content c:\hosts.txt) | select Name)
    
    #Get VMs for each host
    foreach ($esx in $hostlist) {
      $VMs = Get-VMHost $esx | Get-VM
      foreach ($vm in $VMs) {
        Write-host $vm.Name
        Write-host $vm.MemoryMB
        Write-host $vm.numcpu
        Write-host $vm.Guest
      }
    }
    
  • Need help with the site of Editions for a friend - Thnx

    Hello

    I recently got in creating websites so I am pretty new to this, Ive created a site for a friend with dreamweaver CS5 and it looks pretty awesome I also published the site using dreamweaver. Then a few weeks later, my friend started telling me to put new images etc. because it is not familiar with dreamweaver and guys its becomes a bit boring. I want him to be able to post pictures and texts on his own, but I do not know how, someone told me that other cms joomla. And the noob I am I couldn't understand oy what are these programs... Anyone has any advice, tutorials or something useful please share it with me.

    Thnx in andvance and sorry if spelling is a bit messy enlish is my 3rd language.

    Viktoriya El Madhoun wrote:

    I have a major in mathematics and science

    Huumm... he need more money both of those in the design of Web site.

    Viktoriya El Madhoun wrote:

    I plan to learn flash too, Whats ure opinion on flash, Ive been reading online and many people say it's a dying art? Should I learn, or just ignore it?

    As John says, I would not bother. Flash does not work on the iphone or the ipad is a reading in which direction he's going.

    The big money is to know a language like php/mysql server, so if you can get your head around those and combine it with your in-depth knowledge of html/css, it will give you a great competitive advantage.

    Many more customers now wonder for Web sites with a sort of interactivilty. To offer those you must know an inner language server outwards or you will be limited to base sites, which can produce zillions of others.

  • Need help with simple if/then script

    I'm trying to replicate a simple if/then statement excel in a PDF form. Have tried several things, but am just not a scripter Java.  The hope that I could get help from the community.

    I have three boxes that contain information on costs. They are labeled LaborCost, MaterialCost & EquipmentCost. Later, in the form, I have two boxes of different output for the sum out of my first three boxes.  If it's a positive number and the other is a negative number.  In Excel forumla language, that's what each of the boxes would read as:

    For the 1st result if it is a positive number: @if (+ LaborCost + MaterialCost + EquipmentCost > 0, + LaborCost + MaterialCost + EquipmentCost, 0)

    For the 2nd result if it is a negative number: @if (+ LaborCost + MaterialCost + EquipmentCost < 0, + LaborCost + MaterialCost + EquipmentCost, 0)

    I think that this should be a simple thing to write, but I'm not familiar with the games of the appropriate language.

    Your colletive help is VERY appreciated.

    Steven

    Try following the calculation script customized:

    // Sum the field values, as numbers
    var sum = +getField("LaborCost").value;
    sum += +getField("MaterialCost").value;
    sum += +getField("EquipmentCost").value;
    
    // Set this field value
    event.value = sum > 0 ? sum : 0;
    

    For others, change the last line:

    Event.Value = sum< 0="" sum="" :="">

  • Flash beginner needs help with Movie Clips/Action script

    HI -.

    I'm having a problem with my video clips playing simultaneously and cannot, for the life of me, know what I did wrong. I'm new to flash so I can I have created something wrong but this is what I have so far:

    11 layers, total: 1 layer with 10 buttons, each button with the following actionscript code:


    on (release) {}
    gotoAndPlay (85);
    }


    When the number changes with regard to keyframes, the next film is about.

    I have 10 films, total, but they are only video clips, mainly photo slideshow with audio, does everything in the library.

    The problem occurs when I click on the second or third button. Not only the movie I selected starts to play, but all previous clips are as well, he has completely blurred all the sounds. I don't know what Miss me in action script, as my Action layer has a stop command to this topic at each keyframe where there is a new clip to play.

    I tried to add a stopAllSounds command, but I'm afraid that does nothing because it is not an "audio file" in itself playing in the timeline panel.

    I'm at the end of my rope and really need help to understand this one. My project is hanging in the balance on this point, I wrote everything correctly and it works beautifully.

    Help, please!

    Thank you
    Caroline

    Start your sounds in frame 2 and place stopAllSounds() on each keyframe where begins a movieclip.

  • Need help with installing the driver Vista for Satellite A200-23U

    INSTALL THE

    WINDOWS VISTA
    N ° Version of the component name
    1 Windows Vista RTM
    2 native Intel ICH7M Chipset utility
    3 945GM Intel display driver
    or
    3 nVIDIA Display Driver G72MV-A3/NB7P-GS
    Realtek Audio driver ALC861D 4
    5 Realtek 8101E 10/100 / Driver LAN Gigabit 8111
    6 Synaptics Touch Pad Driver (with LuxPad)
    7 ALPS Touch Pad Driver
    8 card reader TI Multiple digital media
    9 TOSHIBA software modem
    10 Golan Intel Wireless LAN Driver
    11 Kedron Intel Wireless LAN Driver
    12 Atheros Wireless LAN Driver
    Camera Chicony 13 software
    14 Bluetooth Stack for Windows by Toshiba
    15 Bluetooth monitor
    16 TOSHIBA Value Added Package
    17 TOSHIBA Flash Cards Support utility
    TOSHIBA 18 hardware configuration utility
    19 TOSHIBA supervisor password
    20 TOSHIBA SD Memory utilities
    21 TOSHIBA ConfigFree
    22 TOSHIBA Assist
    TOSHIBA Speech System 23
    24 TOSHIBA Extended tiles for Mobility Center Windows V1.01
    TOSHIBA Fingerprint Utility V5.6.0.3221 25

    But the [code] http://eu.computers.toshiba-europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp?service=EU&mode=allMachi nes & action = search & teddProduct = 738 & selShortMod = 532 [/ code] I don't know what connection is No2 chipset driver (I use vista 32 bit), similar what link is No3 display driver.

    Can you help me to download 25 entry because I'm bad at computing :(
    Sorry because of my English... THX

    Hey Buddy

    You have a machine with the ATI graphics card. Am I wrong?
    If Yes, then the Chipset driver is ALREADY included in the ATI graphics driver that is available on the European driver Toshiba page!

    The order of installation displays the instructions step by step for all THE portable Satellite A200 PSAE6E but the fact is that devices were equipped with different material parts and that's why some single drivers do not appear or are not available.

    Once again; Utility/driver chipset is available/included in the ATI graphics driver

    Good bye

  • Need help with upgrade from WXP MCE for Vista Ultimate on Qosmio G30 - 175

    Hi all, I tried to search for the problem following without success so I would be very grateful if someone could help and point me in the right direction:

    "Tried to upgrade XP to ultimate and he arrived at the stadium and BSOD unpacking" Session3_initialization_failed (xxx STOP: 0x0000006F (0xC000009D, 0x00000000, 0x00000000, 0x00000000) appeared several times.) I tried again and the same thing happened.

    I have already updated the BIOS and stripped the conflict out of the suite of Toshiba of programs and update Advisor gave the OK on several occasions before attempting this exercise.

    Help... Dave

    I forgot to mention also that I'm running with 2 x 2 GB of Ram and no software or additional material has been added before attempting the upgrade. The medium I use to upgrade is that a full version recently bought 32-bit Vista Ultimate (which also includes a 64-bit in the box version, too).

    I was in contact with Microsoft Support these days and they told me that my hard drive seems to be defective as the reason for the failure of the upgrade. Infact last week with Microsoft on the phone did us try a clean install, but that just lead to me having to give up the clean installs and rescue my laptop back to original XP MCE... flipping hell!

  • Help with the cluster in table for the cluster size difference, please!

    I will admit to still hurt with the berries of LabVIEW, and as usual, the behavior in the vi attached is meaningless to me!  The attached vi shows a cluster 6 element being converted into a table, then immediately to a cluster.  The reconstructed cluster has 9 elements, even if the table size indicator display properly 6.  How to maintain the initial cluster size when converting to and then since then, a table?

    The f

    Well, if you have worked with context-sensitive help running you would see:

    "With the right button of the function and select the Size of Cluster in the context menu to set the number of items in the cluster."

    The default is new. The maximum cluster size for this function is 256. »

    You must set the size. There is no way for the function to know how many elements in the table.

Maybe you are looking for