Re: Problem with function
| From: | Jochem Maas | Date: | Fri, 12 Sep 2008 13:02:49 +0000 |
| Subject: | Re: Problem with function | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-279980@lists.php.net to get a copy of this message | ||
Jason Pruim schreef:
....
I don't think notify_email() is called, find out what is dying before you get to this line. note you'll get 'echo '10';' before you get 'echo '1';'my guess is you never reach this line.
Normally I do much better... Usually I have a better idea where the issue is so I can boil it down to a smaller area. This time though... I'm clueless so I figured it would be better to post more :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com japruim@raoset.comnotify_email($Record, $salesRepID); $stmt = mysqli_stmt_init($link);consider posting example code that is a little more succinct, it also helps *you* if you take the time to write test code that strips everything not directly related to the problem it's usually easier to find it.//Create the statementmysqli_stmt_prepare($stmt, "UPDATE purl.schreur SETFName = ?, LName = ?, email = ?, phone = ?, record = ?, subscribed = ?, date = ?, IPAddress = ?, Business = ?, Address1 = ?, City = ?, State = ?, Zip = ?, Coffee = ?, Meeting = ?, time = ?")or die("prepare error " . mysqli_error($link)); mysqli_stmt_bind_param($stmt, 'ssssssssssssssss',$_POST['txtFName'], $_POST['txtLName'], $_POST['txtEmail'], $_POST['txtPhone'], $_POST['record'], $_POST['subscribed'], $date, $_SERVER['REMOTE_ADDR'], $_POST['txtBusiness'], $_POST['txtAddress1'], $_POST['txtCity'], $_POST['txtState'], $_POST['txtZip'], $_POST['rdoCoffee'], $_POST['rdoTime'], $_POST['areaPlans'])or die( "bind error " . mysqli_error($link)); //Add the record mysqli_stmt_execute($stmt) or die( "execute error " . mysqli_error($link));?>notify_email.php file: <?PHPfunction notify_email($Record, $salesRepID) { require("defaults.php"); require("func.sendemail.php"); require("dbmysqliconnect.php"); $salesRep = array(1 => "tim@schreurprinting.com, jpruim@schreurprinting.com", 2 => "richardc@schreurprinting.com, jpruim@schreurprinting.com", 3 =>"jpruim@schreurprinting.com", 4=>"japruim@raoset.com"); echo "1"; $link1 = dbmysqliconnect($server, $username, $password, $database, $link);echo "2";$sql = "SELECT * FROM schreur WHERE record='{$Record}'"; $row[] = mysqli_query($link1, $sql) or die("Could not perform query: ".mysqli_errno($link1));echo "3";$result = $row[0]; echo "4"; // $dataSet = array(); // while ($row = mysqli_fetch_assoc($result)) {//echo "<br>while<BR>";// $dataSet[] = $row; // } $from= "No-Reply@schreurprinting.com"; echo "5"; $returnPath = "no-reply@schreurprinting.com"; $replyTo = "no-reply@schreurprinting.com"; echo $Record; echo "6"; // echo "<br>Just before while in notify_email.php<br>"; // echo "<br>directly above while<br>"; // echo "<BR>dataset print: "; // print_r($dataSet); // echo "<BR>"; // echo "<br>directly above foreach<br>"; //foreach ( $dataSet AS $row ) { echo "6"; while ($row = mysqli_fetch_assoc($result)) { echo "inside while"; //Build the e-mail headers $ID = $row['salesRep']; $to = $salesRep[$ID]; $headers = "From: ".$from."\n"; $headers .= "Return-Path: ".$returnPath."\n"; $headers .= "Reply-To: ".$replyTo."\n"; $subject = "{$row['FName']} wants coffee!"; $message = "First Name: {$row['FName']} \n"; $message .= "Last Name: {$row['LName']}\n"; $message .= "Company " . $row['Business'] . "\n"; $message .= "Email:" .$row['email'] . "\n"; $message .= "Phone: " .$row['phone'] . "\n"; $message .= "Address: " . $row['Address1'] . "\n"; $message .= "City: " . $row['City'] . "\n"; $message .= "State: " .$row['State'] . "\n"; $message .= "Zip: ". $row['Zip'] . "\n"; $message .= "Coffee of choice: ".$row['Coffee'] . "\n\n"; $message .= "When a good time would be: \n".$row['Meeting'] . "\n\n"; $message .= "Current plans: \n\n"; $message .= $row['plans'] . "\n\n"; send_email($to, $subject, $message, $headers); }echo "7";echo <<<PRE <pre>Headers: $headers To: $to Subject: $subject Message:$message </pre>PRE; echo "8";echo "Just after end of while in notify_email.php"; // header("Location: index.php"); echo "9";} //Function closed echo "10"; ?> yes all of the echo's in there are for testing purposes to see where it's choking. Ever since I started using mod_rewrite, I seem to have lost my error reporting from php so if someone knows a trick on how to fix that I would appreciate it :) On my page when I load it, all I see is the "10" I echo at the end of the notify_email function. I think I'm having another dense moment and it will be something simple but I have looked over the code for the past day with no break throughs.... So ANY help is greatly appreciated, and comes with a beverage of choice if you can make it to where I am! :)