Jump to content

Daadian

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Daadian's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sorry guys I went back and fixed it. I guess I should have previewed it first. Copy paste must hate me. Thanks for understanding
  2. Please help ! Hi guys, I am literally at my wits end with this and I am almost positive its in my code. This code is from a blackberry app that sends the infor into PHP, that part works flawlessy and was working just fine until I added the code to get the supervisor email from a different table based off a query. What happens is the information gets posted three times, The first time the emails are triggered and the post happens succefully, both the user and the supervisor get the properly formatted emails. This happens almost immediately, works great. Then almost immediately, the supervisor will get two more emails, with the same information except missing the orignal users email, presumably the user would have gotten two more emails as well if the email address was available. The mysql DB gets all 3 records with the second two missing the user email. Here is my code: <?php $dbServer1='contractor.emcee.tv'; $dbUser1='******'; $dbPass1='******'; $dbName1='purchaseorders'; $link = mysqli_connect("$dbServer1", "$dbUser1", "$dbPass1") or die("Could not connect post"); mysqli_select_db($link,"$dbName1") or die("Could not select database your_db_name1"); $job = $_GET['jobnumber']; $vend = $_GET['vendor']; $cat = $_GET['category']; $amt = $_GET['amount']; $note = $_GET['note']; $email = $_SERVER['HTTP_RIM_DEVICE_EMAIL']; $sql = mysqli_query($link,"insert po (job,vend,cat,amount,user,notes,date) values ('$job','$vend','$cat','$amt','$email','$note',NOW())"); if (!$sql){ print("FAILED"); } else { print("SUCCESS"); $query = "SELECT MAX(id) AS PO from po"; $result = mysqli_query($link, $query) Or die(mysqli_error($link)) ; while ($row = mysqli_fetch_assoc($result)) { $po = $row['PO']; } $query2 = "SELECT supervisoremail FROM job WHERE jobnum = $job"; $result2 = mysqli_query($link, $query2)Or die(mysqli_error($link)); while ($row2 =mysqli_fetch_assoc($result2)){ $sup = $row2['supervisoremail']; } $subject = "Purchase Order Request"; $supsubject = "FYI Purchase Order Completion"; $body = "Your purchase order request has been completed. \n \n Your PO number is: $po \n \n Job Number:$job \n Vendor:$vend \n Category:$cat \n Amount:$amt \n Items: \n $note \n \n A copy of this email has been sent to your supervisor."; $supbody = "A purchase order request has been completed. \n \n PO number $po was issued to $email for the following: \n \n Job Number:$job \n Vendor:$vend \n Category:$cat \n Amount:$amt \n Items: \n $note \n \n Please address this if this request is in error."; mail($email, $subject, $body); mail($sup, $supsubject, $supbody); } ?>
×
×
  • 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.