Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

Everything posted by jakebur01

  1. I found the problem. This query SELECT * FROM SA_CUST_ITEM_CLS WHERE ITEM_CLASS = 'YKP' or ITEM_CLASS = 'YKU'or ITEM_CLASS = 'YKT' AND CUSTOMER_NUM='1592' is returning about 40 rows and it should only be returning about 3. Thant Customer_Num should be preventing this. Do I have something wrong in my query? Jake
  2. Here is the full code. Sorry about it not being neat or formatted. I have three tables. customers, customer master, customer shipping addresses, and customer sales based on class. I am querying the customer master then querying the customer sales by class to see if their total is above 500. If it is then the shipping address is retrieved from the shipping address table if their is a address it will insert the line into customers table. <?php set_time_limit(900); ini_set('max_execution_time', '999'); require("../inc/data.inc"); mysql_query('TRUNCATE TABLE customers;'); $query="SELECT * FROM AR_CUST_MAST WHERE ACTIVE='Y' AND CUSTOMER_CLASS<>'RET' AND CUSTOMER_CLASS<>'REF' AND CUSTOMER_CLASS<>'GCA' AND CUSTOMER_CLASS<>'OUT' AND CUSTOMER_CLASS<>'REC' AND CUSTOMER_CLASS<>'SSC' AND CUSTOMER_CLASS<>'WHS' AND CUSTOMER_CLASS<>'SDD'"; echo "$query<br /><br />"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $acct =$row['CUSTOMER_NUM']; /* $TOTAL=0; $SALES1=0; $SALES2=0; $SALES3=0; $SALES4=0; $SALES5=0; $SALES6=0; $SALES7=0; $SALES8=0; $SALES9=0; $SALES10=0; $SALES11=0; $SALES12=0; $SALES13=0; $SALES14=0; $SALES15=0; $SALES16=0; $SALES17=0; $SALES18=0; $SALES19=0; $SALES20=0; $SALES21=0; $SALES22=0; $SALES23=0; $SALES24=0; $SALES25=0; $SALES26=0; $SALES27=0; */ $query2="SELECT * FROM SA_CUST_ITEM_CLS WHERE ITEM_CLASS = 'YKP' or ITEM_CLASS = 'YKU'or ITEM_CLASS = 'YKT' AND CUSTOMER_NUM='$acct'"; echo "$query2<br /><br />"; $result2 = mysql_query($query2); $num_rows = mysql_num_rows($result2); if($num_rows>"0") { while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $sales1 +=$row2['SALES_OLDEST_PD']; $sales2 +=$row2['SALES_PD_2']; $sales3 +=$row2['SALES_PD_3']; $sales4 +=$row2['SALES_PD_4']; $sales5 +=$row2['SALES_PD_5']; $sales6 +=$row2['SALES_PD_6']; $sales7 +=$row2['SALES_PD_7']; $sales8 +=$row2['SALES_PD_8']; $sales9 +=$row2['SALES_PD_9']; $sales10 +=$row2['SALES_PD_10']; $sales11 +=$row2['SALES_PD_11']; $sales12 +=$row2['SALES_PD_12']; $sales13 +=$row2['SALES_PD_13']; $sales14 +=$row2['SALES_PD_14']; $sales15 +=$row2['SALES_PD_15']; $sales16 +=$row2['SALES_PD_16']; $sales17 +=$row2['SALES_PD_17']; $sales18 +=$row2['SALES_PD_18']; $sales19 +=$row2['SALES_PD_19']; $sales20 +=$row2['SALES_PD_20']; $sales21 +=$row2['SALES_PD_21']; $sales22 +=$row2['SALES_PD_22']; $sales23 +=$row2['SALES_PD_23']; $sales24 +=$row2['SALES_PD_24']; $sales25 +=$row2['SALES_PD_25']; $sales26 +=$row2['SALES_LAST_PD_26']; $sales27 +=$row2['SALES_CURR']; } $TOTAL = $sales1 + $sales2 + $sales3 + $sales4 + $sales5 + $sales6 + $sales7 + $sales8 + $sales9 + $sales10 + $sales11 + $sales12 + $sales13 + $sales14 + $sales15 + $sales16 + $sales17 + $sales18 + $sales19 + $sales20 + $sales21 + $sales22 + $sales23 + $sales24 + $sales25 + $sales26 + $sales27; echo"<br />$TOTAL<br /><br />"; if($TOTAL<"500") { // do nothing } else { $COMPANY= mysql_real_escape_string($row['COMPANY']); $CUSTOMER_NUM=$row['CUSTOMER_NUM']; $CUSTOMER_NAME=mysql_real_escape_string($row['CUSTOMER_NAME']); $ADDRESS_1=mysql_real_escape_string($row['ADDRESS_1']); $ADDRESS_2=mysql_real_escape_string($row['ADDRESS_2']); $ADDRESS_3=mysql_real_escape_string($row['ADDRESS_3']); $CITY=mysql_real_escape_string($row['CITY']); $STATE=mysql_real_escape_string($row['STATE']); $ZIP_CODE=mysql_real_escape_string($row['ZIP_CODE']); $PHONE_1=mysql_real_escape_string($row['PHONE_1']); $PHONE_2=mysql_real_escape_string($row['PHONE_2']); $CONTACT_1=mysql_real_escape_string($row['CONTACT_1']); $CONTACT_2=mysql_real_escape_string($row['CONTACT_2']); $EMAIL_1=mysql_real_escape_string($row['EMAIL_1']); $EMAIL_2=mysql_real_escape_string($row['EMAIL_2']); $WEBSITE=mysql_real_escape_string($row['WEBSITE']); $CUSTOMER_CLASS=mysql_real_escape_string($row['CUSTOMER_CLASS']); $SLSP_TERR=mysql_real_escape_string($row['SLSP_TERR']); $TERMS_CODE=mysql_real_escape_string($row['TERMS_CODE']); $PRICE_LEVEL=mysql_real_escape_string($row['PRICE_LEVEL']); $MTD_SALES_AMT=mysql_real_escape_string($row['MTD_SALES_AMT']); $MTD_COST_AMT=mysql_real_escape_string($row['MTD_COST_AMT']); $YTD_SALES_AMT=mysql_real_escape_string($row['YTD_SALES_AMT']); $YTD_COST_AMT=mysql_real_escape_string($row['YTD_COST_AMT']); $PYR_SALES_AMT=mysql_real_escape_string($row['PYR_SALES_AMT']); $PYR_COST_AMT=mysql_real_escape_string($row['PYR_COST_AMT']); $BALANCE=mysql_real_escape_string($row['BALANCE']); $HIGH_BALANCE=mysql_real_escape_string($row['HIGH_BALANCE']); $CREDIT_LIMIT=mysql_real_escape_string($row['CREDIT_LIMIT']); $MESSAGE=mysql_real_escape_string($row['MESSAGE']); $CUST_PRICE_CLASS=mysql_real_escape_string($row['CUST_PRICE_CLASS']); /* $ASSIGNED_DATE=$row['ASSIGNED_DATE']; $OPENED_DATE=$row['OPENED_DATE']; $LAST_SALE_DATE=$row['LAST_SALE_DATE']; $LAST_PMT_DATE=$row['LAST_PMT_DATE']; $HIGH_BAL_DATE=$row['HIGH_BAL_DATE']; */ $query3="SELECT * FROM ar_ship_to_addr WHERE CUSTOMER_NUM='$acct'"; echo "$query3<br /><br />"; $result3 = mysql_query($query3); while($row3 = mysql_fetch_array($result3, MYSQL_ASSOC)) { $num_rows = mysql_num_rows($result2); if($num_rows>"0") { $acct =$row3['CUSTOMER_NUM']; $SHIP_TO_NAME=mysql_real_escape_string($row3['SHIP_TO_NAME']); $COMPANY=mysql_real_escape_string($row3['COMPANY']); $SHIP_TO_ADDR_1=mysql_real_escape_string($row3['SHIP_TO_ADDR_1']); $SHIP_CITY=mysql_real_escape_string($row3['SHIP_CITY']); $SHIP_STATE=mysql_real_escape_string($row3['SHIP_STATE']); $SHIP_ZIP_CODE=mysql_real_escape_string($row3['SHIP_ZIP_CODE']); $insert1="INSERT INTO customers VALUES ('0','$COMPANY', '$CUSTOMER_NUM', '$CUSTOMER_NAME', '$ADDRESS_1', '$ADDRESS_2', '$ADDRESS_3', '$CITY', '$STATE', '$ZIP_CODE', '$SHIP_TO_NAME', '$SHIP_TO_ADDR_1', '$SHIP_CITY', '$SHIP_STATE', '$SHIP_ZIP_CODE', '$PHONE_1', '$PHONE_2', '$CONTACT_1', '$CONTACT_2', '$EMAIL_1', '$EMAIL_2', '$WEBSITE', '$CUSTOMER_CLASS', '$SLSP_TERR', '$TERMS_CODE', '$PRICE_LEVEL', '$MTD_SALES_AMT', '$MTD_COST_AMT', '$YTD_SALES_AMT', '$YTD_COST_AMT', '$PYR_SALES_AMT', '$PYR_COST_AMT', '$BALANCE', '$HIGH_BALANCE', '$CREDIT_LIMIT' , '$MESSAGE', '$CUST_PRICE_CLASS', '$TOTAL')"; echo"<br /><br />$insert1<br /><br />"; mysql_query($insert1) or die("MySQL ERROR: ".mysql_error()); } else { $insert2="INSERT INTO customers VALUES ('0','$COMPANY', '$CUSTOMER_NUM', '$CUSTOMER_NAME', '$ADDRESS_1', '$ADDRESS_2', '$ADDRESS_3', '$CITY', '$STATE', '$ZIP_CODE', '0', '0', '0', '0', '0', '$PHONE_1', '$PHONE_2', '$CONTACT_1', '$CONTACT_2', '$EMAIL_1', '$EMAIL_2', '$WEBSITE', '$CUSTOMER_CLASS', '$SLSP_TERR', '$TERMS_CODE', '$PRICE_LEVEL', '$MTD_SALES_AMT', '$MTD_COST_AMT', '$YTD_SALES_AMT', '$YTD_COST_AMT', '$PYR_SALES_AMT', '$PYR_COST_AMT', '$BALANCE', '$HIGH_BALANCE', '$CREDIT_LIMIT' , '$MESSAGE', '$CUST_PRICE_CLASS', '$ASSIGNED_DATE', '$OPENED_DATE', '$LAST_SALE_DATE', '$LAST_PMT_DATE', '$HIGH_BAL_DATE', '$TOTAL')"; echo"<br /><br />$insert2<br /><br />"; mysql_query($insert2) or die("MySQL ERROR: ".mysql_error()); } } } } else { //do nothing } } ?>
  3. I am getting numbers totaling up in the millions when it should only be 50,000 or less. I am also getting undefined variable errors on the $Sale1, $Sales2, etc. variables on the first loop. } was left out when I copied the code over. Jake
  4. Is this the correct way to do this? if($num_rows>"0") { while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $sales1 +=$row2['SALES_OLDEST_PD']; $sales2 +=$row2['SALES_PD_2']; $sales3 +=$row2['SALES_PD_3']; $sales4 +=$row2['SALES_PD_4']; $sales5 +=$row2['SALES_PD_5']; $sales6 +=$row2['SALES_PD_6']; $sales7 +=$row2['SALES_PD_7']; $sales8 +=$row2['SALES_PD_8']; $sales9 +=$row2['SALES_PD_9']; $sales10 +=$row2['SALES_PD_10']; $sales11 +=$row2['SALES_PD_11']; $sales12 +=$row2['SALES_PD_12']; $sales13 +=$row2['SALES_PD_13']; $sales14 +=$row2['SALES_PD_14']; $sales15 +=$row2['SALES_PD_15']; $sales16 +=$row2['SALES_PD_16']; $sales17 +=$row2['SALES_PD_17']; $sales18 +=$row2['SALES_PD_18']; $sales19 +=$row2['SALES_PD_19']; $sales20 +=$row2['SALES_PD_20']; $sales21 +=$row2['SALES_PD_21']; $sales22 +=$row2['SALES_PD_22']; $sales23 +=$row2['SALES_PD_23']; $sales24 +=$row2['SALES_PD_24']; $sales25 +=$row2['SALES_PD_25']; $sales26 +=$row2['SALES_LAST_PD_26']; $sales27 +=$row2['SALES_CURR']; } $TOTAL = $sales1 + $sales2 + $sales3 + $sales4 + $sales5 + $sales6 + $sales7 + $sales8 + $sales9 + $sales10 + $sales11 + $sales12 + $sales13 + $sales14 + $sales15 + $sales16 + $sales17 + $sales18 + $sales19 + $sales20 + $sales21 + $sales22 + $sales23 + $sales24 + $sales25 + $sales26 + $sales27; echo"<br />$TOTAL<br /><br />"; Thanks, Jake
  5. Opened date is the second one. This is an echo of part of the query. '2003-11-14', '', '2011-06-28', '2011-06-30', '2010-03-11', '5169' Opened date is ''
  6. MySQL ERROR: Incorrect date value: '' for column 'OPENED_DATE' at row 1 The columns are set to allow null. Jake
  7. MySQL ERROR: Incorrect date value: '' for column 'OPENED_DATE' at row 1
  8. How can I insert a date if it doesn't have a value. MySQL column is formatted as date. I am getting an error while inserting. Not all of the rows have dates. $ASSIGNED_DATE=$row['ASSIGNED_DATE']; $OPENED_DATE=$row['OPENED_DATE']; $LAST_SALE_DATE=$row['LAST_SALE_DATE']; $LAST_PMT_DATE=$row['LAST_PMT_DATE']; $HIGH_BAL_DATE=$row['HIGH_BAL_DATE'];
  9. nevermind... I was just going to fast. My queries were not even right. I was getting ahead of myself.
  10. I am getting this fast cgi error while trying to run the script below. FastCGI Error The FastCGI Handler was unable to process the request. Error Details: The FastCGI process exceeded configured request timeout Error Number: 258 (0x80070102). Error Description: The wait operation timed out. HTTP Error 500 - Server Error. Internet Information Services (IIS) <?php set_time_limit(900); ini_set('max_execution_time', '999'); require("../inc/data.inc"); mysql_query('TRUNCATE TABLE yamakoyo_customers;'); $conn=odbc_connect('FACTS','',''); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM AR_CUST_MAST WHERE ACTIVE='Y' AND CUSTOMER_CLASS<>'RET' AND CUSTOMER_CLASS<>'REF' AND CUSTOMER_CLASS<>'GCA' AND CUSTOMER_CLASS<>'OUT' AND CUSTOMER_CLASS<>'REC' AND CUSTOMER_CLASS<>'SSC' AND CUSTOMER_CLASS<>'WHS' AND CUSTOMER_CLASS<>'SDD'"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} setlocale(LC_MONETARY, 'en_US'); while (odbc_fetch_row($rs)) { $sql2="SELECT * FROM SA_CUST_ITEM_CLS WHERE ITEM_CLASS >= 'YKP' AND ITEM_CLASS <= 'YKU'"; $rs=odbc_exec($conn,$sql2); if (!$rs) {exit("Error in SQL");} setlocale(LC_MONETARY, 'en_US'); while (odbc_fetch_row($rs2)) { $sales1 +=odbc_result($rs2,"SALES_OLDEST_PD"); $sales2 +=odbc_result($rs2,"SALES_PD_2"); $sales3 +=odbc_result($rs2,"SALES_PD_3"); $sales4 +=odbc_result($rs2,"SALES_PD_4"); $sales5 +=odbc_result($rs2,"SALES_PD_5"); $sales6 +=odbc_result($rs2,"SALES_PD_6"); $sales7 +=odbc_result($rs2,"SALES_PD_7"); $sales8 +=odbc_result($rs2,"SALES_PD_8"); $sales9 +=odbc_result($rs2,"SALES_PD_9"); $sales10 +=odbc_result($rs2,"SALES_PD_10"); $sales11 +=odbc_result($rs2,"SALES_PD_11"); $sales12 +=odbc_result($rs2,"SALES_PD_12"); $sales13 +=odbc_result($rs2,"SALES_PD_13"); $sales14 +=odbc_result($rs2,"SALES_PD_14"); $sales15 +=odbc_result($rs2,"SALES_PD_15"); $sales16 +=odbc_result($rs2,"SALES_PD_16"); $sales17 +=odbc_result($rs2,"SALES_PD_17"); $sales18 +=odbc_result($rs2,"SALES_PD_18"); $sales19 +=odbc_result($rs2,"SALES_PD_19"); $sales20 +=odbc_result($rs2,"SALES_PD_20"); $sales21 +=odbc_result($rs2,"SALES_PD_21"); $sales22 +=odbc_result($rs2,"SALES_PD_22"); $sales23 +=odbc_result($rs2,"SALES_PD_23"); $sales24 +=odbc_result($rs2,"SALES_PD_24"); $sales25 +=odbc_result($rs2,"SALES_PD_25"); $sales26 +=odbc_result($rs2,"SALES_LAST_PD_26"); $sales27 +=odbc_result($rs2,"SALES_CURR"); } $TOTAL = $sales1 + $sales2 + $sales3 + $sales4 + $sales5 + $sales6 + $sales7 + $sales8 + $sales9 + $sales10 + $sales11 + $sales12 + $sales13 + $sales14 + $sales15 + $sales16 + $sales17 + $sales18 + $sales19 + $sales20 + $sales21 + $sales22 + $sales23 + $sales24 + $sales25 + $sales26 + $sales27; $TOTAL = number_format($TOTAL, 2, '.', ','); if($TOTAL<"500") { // do nothing } else { $COMPANY=odbc_result($rs2,"COMPANY"); $CUSTOMER_NUM=odbc_result($rs2,"CUSTOMER_NUM"); $CUSTOMER_NAME=odbc_result($rs2,"CUSTOMER_NAME"); $ADDRESS_1=odbc_result($rs2,"ADDRESS_1"); $ADDRESS_2=odbc_result($rs2,"ADDRESS_2"); $ADDRESS_3=odbc_result($rs2,"ADDRESS_3"); $CITY=odbc_result($rs2,"CITY"); $STATE=odbc_result($rs2,"STATE"); $ZIP_CODE=odbc_result($rs2,"ZIP_CODE"); $SHIP_TO_NAME=odbc_result($rs2,"SHIP_TO_NAME"); $COMPANY=odbc_result($rs2,"COMPANY"); $SHIP_TO_ADDR_1=odbc_result($rs2,"SHIP_TO_ADDR_1"); $SHIP_CITY=odbc_result($rs2,"SHIP_CITY"); $SHIP_STATE=odbc_result($rs2,"SHIP_STATE"); $SHIP_ZIP_CODE=odbc_result($rs2,"SHIP_ZIP_CODE"); $PHONE_1=odbc_result($rs2,"PHONE_1"); $PHONE_2=odbc_result($rs2,"PHONE_2"); $CONTACT_1=odbc_result($rs2,"CONTACT_1"); $CONTACT_2=odbc_result($rs2,"CONTACT_2"); $EMAIL_1=odbc_result($rs2,"EMAIL_1"); $EMAIL_2=odbc_result($rs2,"EMAIL_2"); $WEBSITE=odbc_result($rs2,"WEBSITE"); $CUSTOMER_CLASS=odbc_result($rs2,"CUSTOMER_CLASS"); $SLSP_TERR=odbc_result($rs2,"SLSP_TERR"); $TERMS_CODE=odbc_result($rs2,"TERMS_CODE"); $PRICE_LEVEL=odbc_result($rs2,"PRICE_LEVEL"); $MTD_SALES_AMT=odbc_result($rs2,"MTD_SALES_AMT"); $MTD_COST_AMT=odbc_result($rs2,"MTD_COST_AMT"); $YTD_SALES_AMT=odbc_result($rs2,"YTD_SALES_AMT"); $YTD_COST_AMT=odbc_result($rs2,"YTD_COST_AMT"); $PYR_SALES_AMT=odbc_result($rs2,"PYR_SALES_AMT"); $PYR_COST_AMT=odbc_result($rs2,"PYR_COST_AMT"); $BALANCE=odbc_result($rs2,"BALANCE"); $HIGH_BALANCE=odbc_result($rs2,"HIGH_BALANCE"); $CREDIT_LIMIT=odbc_result($rs2,"CREDIT_LIMIT"); $MESSAGE=odbc_result($rs2,"MESSAGE"); $CUST_PRICE_CLASS=odbc_result($rs2,"CUST_PRICE_CLASS"); $ASSIGNED_DATE=odbc_result($rs2,"ASSIGNED_DATE"); $OPENED_DATE=odbc_result($rs2,"OPENED_DATE"); $LAST_SALE_DATE=odbc_result($rs2,"LAST_SALE_DATE"); $LAST_PMT_DATE=odbc_result($rs2,"LAST_PMT_DATE"); $HIGH_BAL_DATE=odbc_result($rs2,"HIGH_BAL_DATE"); // do mysql insert mysql_query("INSERT INTO yamakoyo_customers VALUES ('0','$COMPANY', '$CUSTOMER_NUM', '$CUSTOMER_NAME', '$ADDRESS_1', '$ADDRESS_2', '$ADDRESS_3', '$CITY', '$STATE', '$ZIP_CODE', '$SHIP_TO_NAME', '$SHIP_TO_ADDR_1', '$SHIP_CITY', '$SHIP', '$SHIP_STATE', '$SHIP_ZIP_CODE', '$PHONE_1', '$PHONE_2', '$CONTACT_1', '$CONTACT_2', '$EMAIL_1', '$EMAIL_2', '$WEBSITE', '$CUSTOMER_CLASS', '$SLSP_TERR', '$TERMS_CODE', '$PRICE_LEVEL', '$MTD_SALES_AMT', '$MTD_COST_AMT', '$YTD_SALES_AMT', '$YTD_COST_AMT', '$PYR_SALES_AMT', '$PYR_COST_AMT', '$BALANCE', '$HIGH_BALANCE', '$CREDIT_LIMIT' , '$MESSAGE', '$CUST_PRICE_CLASS', '$ASSIGNED_DATE', '$OPENED_DATE', '$LAST_SALE_DATE', '$LAST_PMT_DATE', '$HIGH_BAL_DATE', '$TWO_YEAR')"); sleep(5); } } ?>
  11. Is there a reliable way to have php process e-mails for a gmail account. I need it to look at all the new e-mails that have VSI-FAX in the subject and run the code below to swipe out the failed fax number. These are fax failure e-mails. $pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i'; preg_match($pattern, $email_body, $matches); $fax_number = trim($matches[0]);
  12. I opened it notepad and this is what I have: <?php $Popmonger = new Popmonger();$body = $Popmonger->BodyText();$pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i';preg_match($pattern, $bodytext, $matches);$faxnumber = trim($matches[0]);$body = $Popmonger->BodyText();$pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i';preg_match($pattern, $bodytext, $matches);$faxnumber = trim($matches[0]);$myFile = "vsifax_failures.txt";$fh = fopen($myFile, 'a') or die("can't open file");$stringData = "$faxnumber\n";fwrite($fh, $stringData);fclose($fh);?> But, if I only put tags in there, I get the same error. I have tried posting to the support group from the company, but I have yet to receive a response. http://support.mach5.com/showthread.php?tid=139
  13. I changed my code to this: <?$Popmonger = new Popmonger();$body = $Popmonger->BodyText();$pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i';preg_match($pattern, $bodytext, $matches);$faxnumber = trim($matches[0]);$body = $Popmonger->BodyText();$pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i';preg_match($pattern, $bodytext, $matches);$faxnumber = trim($matches[0]);$myFile = "vsifax_failures.txt";$fh = fopen($myFile, 'a') or die("can't open file");$stringData = "$faxnumber\n";fwrite($fh, $stringData);fclose($fh);?> I am still getting: Name cannot begin with the '' character, hexadecimal value 0x20. Line 1. Position 12. The error is always Line 1. Position 12. no matter what I put in the file.
  14. Any idea what would cause this error? It doesn't matter what code I have or whether I use <? ?> or <?PHP ?>. It always throws this error in a third party program I have called PopMonger that will allow you to run a php script to handle a returned e-mail. Name cannot begin with the '' character, hexadecimal value 0x20. Line 1.
  15. Now I'm getting this: Notice: Undefined variable: failedAddress in C:\Inetpub\wwwroot\smithsadvantage\popmonger\PopmongerClass.php on line 100 Fatal error: Cannot access empty property in C:\Inetpub\wwwroot\smithsadvantage\popmonger\PopmongerClass.php on line 100
  16. I have this class that was built for testing, but I am unable to get it to work for me. PopmongerClass.php <?php //coded for PHP 5 /** * This class will define an object very similar to the Popmonger object returned by PopMonger 3 itself. This class * can be used for debugging purposes by modifying the fields near the top of the class. To use this class, * either paste the following code into your script, or download the <a href="PopmongerClass.zip" alt="PopmongerClass zipfile">PopmongerClass.php file</a>, * unzip it into the same directory as your Popmonger 3 script, and add the text require('PopmongerClass.php'); * to the top of your current PHP script. If you are not running the script via apache or another web server, you may run * the script with the php.exe Command-Line interpreter. </p> */ class Popmonger { public $fields, $headers, $headerText, $bodyText, $messageText, $failedAddress, $mimeParts; public function __construct() { /** * Fields that would be returned by Popmonger 3 if the "Parse feedback using delimiters" box is checked in * the Actions tab of the Task options. */ $this->fields = array( "Robert" , "Smith" , "bobsmith@university.edu" , "Oct" , "22" , "2006" ); /** * Headers that Popmonger 3 would return for this email. Note that this is an associative array, as is the * array returned by Popmonger 3. */ $this->headers = array( "subject" => "subject" , "from" => "from" , "to" => "to" ); /** * The raw header text for this email. */ $this->headerText = "Subject: ".$this->headers['subject']."\r\nFrom: ".$this->headers['from']."\r\nTo: ".$this->headers['to']; /** * The raw body text for this email. */ $this->bodyText = "This is the body which includes both HTML and TEXT portions if both were sent."; /** * The raw message text for this email. */ $this->messageText = "This is the raw message text which includes the ENTIRE MESSAGE, headers and all."; /** * The original sender address for created a bounced/failure address list. */ $this->failedAddress = "failedaddress@bounced.com"; /** * The MIME parts of this email, which would normally include any files attached. Feel free to use readfile() * here if you actually need to return a file for debugging purposes. */ $this->mimeParts = array( "file 1" , "file 2" , "file 3" ); } /** * This function will return the number of fields that have been successfully parsed by Popmonger 3 (in * this case, a count of the number of fields in the fields var array. * * @return - integer Number of fields parsed out of this email */ function FieldsCount() { return count( $this->fields ); } /** * This function will return the number of MIME parts in this email (in this case, a count of the number of * fields in the mimeParts var array. * * @return - integer Number of MIME parts in this email */ function MIMEPartsCount() { return count( $this->$mimeParts ); } /** * This function will return the message text associated with this email. * * @return - String message text */ function MessageText() { return $this->$messageText; } /** * This function will return the failed sender address associated with a bounced email. * * @return - String message text */ function FailedAddress() { return $this->$failedAddress; } /** * This function will return the header text associated with this email. * * @return - String header text */ function HeaderText() { return $this->$headerText; } /** * This function will return the body text associated with this email. * * @return - String body text */ function BodyText() { return $this->$bodyText; } /** * This function will return the i-th field associated with the email, based on the text that Popmonger 3 * parsed out. Note that this function does not perform any bounds-checking! Use the FieldsCount() function to * ensure that the index is within bounds. * * @param int - Field index to retrieve * * @return - String field value */ function Field( $i ) { return $this->fields[$i]; } /** * Send an email to this recipient. Note that this function does NOT actually send an email! It is only here * for debugging purposes. * * @param String - From: email address * @param String - To: email address * @param String - Subject of the email * @param String - Body of the email * @param String - Headers for this email */ function SendMail( $from , $to , $subject , $body , $headers ) { echo "Would have sent email to ".$to." from ".$from." with subject ".$subject."\r\n"; } /** * Redirect this message to another email address. Note that this function does NOT send email, it is only * here for debugging purposes. * * @param String - Email address to redirect this message to */ function RedirectMessage( $email ) { echo "redirecting this message to ".$email."r\n"; } /** * Reply to this message with this text. Note that thie function does NOT send email, it is only here for * debugging purposes. * * @param String - From: email address * @param String - Subject of the email * @param String - Text to reply with */ function ReplyWithText( $from , $subject , $replyText ) { echo "replying to ".$from." with subject ".$subject." and text ".$replyText."\r\n"; } /** * Save text to a file. * * @param String - Filename to write to * @param String - Text to write to this file * @param boolean - TRUE to append to a file, FALSE to truncate the file to 0 length and then write */ function SaveToFile( $filename , $text , $append ) { $write = 'w'; if( $append == TRUE || $append == '1' ) { $write = 'a'; } $fp = fopen( $filename , $write ); fputs( $fp , $text ); fclose( $fp ); } /** * Returns this header field. This would usually refer to the header fields parsed out by PopMonger, but * for debugging purposes returns the value of this element in the headers var array. * * @param String - Name of the header field to retrieve * * @return String - Value of this header field */ function HeaderField( $name ) { return $this->headers[$name]; } /** * Returns this MIME part of the email. This would usually refer to the MIME parts of the email, but for * debugging purposes returns the value of the mimeParts var array. * * @param integer - Index of the element to retrieve * * @return String - Value of this MIME part of the email */ function MIMEPart( $index ) { return $this->mimeParts[$index]; } } // End of Popmonger Class declaration //Instantiate a new popmonger object with the same name as the object returned by PopMonger itself. //$popmonger = new Popmonger(); //Confirmation that a PopMonger object was created. //echo "Made a new popmonger!"; ?> popmonger.php ( page for testing ) <?php include ('PopmongerClass.php'); echo $Popmonger->FailedAddress(); echo $Popmonger->MessageText(); ?> Here is the error I am getting: Notice: Undefined variable: Popmonger in C:\Inetpub\wwwroot\smithsadvantage\popmonger\popmonger.php on line 4 Fatal error: Call to a member function FailedAddress() on a non-object in C:\Inetpub\wwwroot\smithsadvantage\popmonger\popmonger.php on line 4
  17. This is what I am really looking to do. Retrieve the fax number from the e-mail and write it to a text file. I am just not sure about the class and how it should be formatted. <?php class object Popmonger string HeaderText; string BodyText; string MessageText; string FailedAddress; string HeaderField($sHeader_name); string Field($iFieldNumber); int FieldsCount; string MIMEPart($iPartNumber); int MIMEPartsCount; void RedirectMessage("sTo_address1,To_address2,To_address3"); void ReplyWithText($fsFom_address, $sSubject, $sReply_text); void SendMail($from_address,$sTo_address,$sSubject_text,$sBody_text,$sEx_headers); void SaveToFile($sFile_name, $sText_to_save, $bIsAppend); $pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i'; preg_match($pattern, $bodytext, $matches); $faxnumber = trim($matches[0]); $myFile = "vsifax_failures.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "$faxnumber\n"; fwrite($fh, $stringData); fclose($fh); ?>
  18. I am following this code here http://www.mach5.com/products/popmonger/manual30/scripts.html to retrieve sections of the returned e-mail. However, this class does not look right. class object Popmonger string HeaderText; string BodyText; string MessageText; string FailedAddress; string HeaderField($sHeader_name); string Field($iFieldNumber); int FieldsCount; string MIMEPart($iPartNumber); int MIMEPartsCount; void RedirectMessage("sTo_address1,To_address2,To_address3"); void ReplyWithText($fsFom_address, $sSubject, $sReply_text); void SendMail($from_address,$sTo_address,$sSubject_text,$sBody_text,$sEx_headers); void SaveToFile($sFile_name, $sText_to_save, $bIsAppend); I want to retrieve the string BodyText; or string MessageText; and run something like this: $pattern = '~fax\s+#\s+:\s+\K(??!from).)+~i'; preg_match($pattern, $bodytext, $matches); $fax = trim($matches[0]);
  19. Thank you crayonviolent. This is exactly what I had in mind. Thank you cssfreakie. Jake
  20. "How can I extract the fax # out of this e-mail message? I will either be using a 3rd party program that handles returned messages or build a little mail reading script that will handle this. I want to extract the fax number located between "To fax # :" and "From fax # :". Here is a copy of the e-mail I will receive when the fax failed: Status for VSI-FAX fax job: 1025 Submitted by: vsifax E-mail : myname@testsite.com Submit time : 06/24 11:15 Queue : fax1 Result : expired Status : Max tries reached To name : <none> From name : VSIFAX Administrator To company : <none> From company: <none> To fax # : 555-555-3551 From fax # : <none> To voice # : <none> From voice #: <none> Subject : <none> Num dialed : 15048323291 usrtag1 : 001210 Cover : 1 pg default File 1 : 2 pgs /u/ssc/ssi7/docdel/001210.vsi Total pgs : 3 pgs Attempt Send-Time Result CSI ------- ----------- ------------------ ---------------- 1 06/24 11:16 Timed out <none> 2 06/24 11:22 No carrier <none> 3 06/24 11:29 Timed out <none> 4 06/24 11:36 Timed out <none> 5 06/24 11:42 Timed out <none>
  21. I really need to keep the dashes and replace forward slashes and periods with dashes. Jake
  22. What about converting the periods and forward slashes to dashes? Would I do something like this? $fax=str_replace('/','-',$fax); $fax=str_replace('.','-',$fax); $fax = preg_replace("/[^0-9]/","", $fax)
  23. Hello, I have database of fax number and I need to copy these numbers to a separate table on a daily basis. The format the customer service employees have been using are: (555)555-5555, 555/555-5555, 555.555.5555, 555/555-5555 FAX, (fax)555/555-5555, etc. I would like to correct and strip the fax number before having them transferred into the database that the actually fax server will be using. Jake $fax=odbc_result($rs,"PHONE_2"); $fax = strtolower($fax); $fax=str_replace('/','-',$fax); $fax=str_replace('.','-',$fax); $find=array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "%", "!", "@", "#", "$", "^", "&", "*","~", "+", ":", "=", "?", "'", "<", '\\', '(', ')', '[', ']', '{', '}'); str_replace($find, '', $fax); $fax=trim($fax);
×
×
  • 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.