Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

Everything posted by jakebur01

  1. Thanks. I used this: $trimFile = end(explode('\\',$trimFile));
  2. Is there a way to trim everything off in front of the last backslash in the string? $trimFile = $fList[$i]; Example: In this path: \\\\myftp/downloads/tom/work/word_docs\\legal\test.pdf I only want to display test.pdf. Thanks, Jake
  3. Does mysql not care for underscores too much?
  4. I need this within the next two hours. If I have to go through the trouble of building a new table. It might be just as fast for me to import the data from the original query into a table then query the data using php and insert the customers whos sales are above 500 into a secondary table.
  5. That's a good idea. If it were you, how would you go about doing that?
  6. ar_cust_mast.COMPANY ar_cust_mast.CUSTOMER_NUM ar_cust_mast.CUSTOMER_NAME ar_cust_mast.ADDRESS_1 ar_cust_mast.ADDRESS_2 ar_cust_mast.ADDRESS_3 ar_cust_mast.CITY ar_cust_mast.STATE ar_cust_mast.ZIP_CODE ar_cust_mast.PHONE_1 ar_cust_mast.PHONE_2 ar_cust_mast.CONTACT_1 ar_cust_mast.CONTACT_2 ar_cust_mast.EMAIL_1 ar_cust_mast.EMAIL_2 ar_cust_mast.WEBSITE ar_cust_mast.ALPHA_SORT_KEY ar_cust_mast.NORMAL_SHIP_TO ar_cust_mast.CUSTOMER_CLASS ar_cust_mast.SLSP_TERR ar_cust_mast.TERMS_CODE ar_cust_mast.TAX_CODE ar_cust_mast.TAX_TYPE ar_cust_mast.PRICE_LEVEL ar_cust_mast.GEOGRAPHY_CODE ar_cust_mast.GL_TABLE ar_cust_mast.MTD_SALES_AMT ar_cust_mast.MTD_COST_AMT ar_cust_mast.YTD_SALES_AMT ar_cust_mast.YTD_COST_AMT ar_cust_mast.PYR_SALES_AMT ar_cust_mast.PYR_COST_AMT ar_cust_mast.BALANCE ar_cust_mast.HIGH_BALANCE ar_cust_mast.CREDIT_LIMIT ar_cust_mast.SITE_CHARGE ar_cust_mast.MESSAGE ar_cust_mast.ON_HOLD ar_cust_mast.STORE_SO_SALES ar_cust_mast.BACKORDER_FLAG ar_cust_mast.STATEMENT_CODE ar_cust_mast.STORE_SO_INVOICE ar_cust_mast.STORE_PAYMENT ar_cust_mast.RECEIVE_DUN ar_cust_mast.LAST_DUN_SENT ar_cust_mast.SVC_CHG_GRACE_PD ar_cust_mast.COMM_PCT ar_cust_mast.OFF_INV_DISC_PCT ar_cust_mast.ROUTE ar_cust_mast.LEDGERCARD_SEQ ar_cust_mast.USE_LEDGERCARDS ar_cust_mast.DEFAULT_BRANCH ar_cust_mast.CREDIT_CHECK ar_cust_mast.INCLUDE_INV ar_cust_mast.ACTIVE ar_cust_mast.NOT_USED_2 ar_cust_mast.PO_REQUIRED ar_cust_mast.UPS_GROUND_CODE ar_cust_mast.CUST_PRICE_CLASS ar_cust_mast.PICK_TKT_PRICES ar_cust_mast.PRINT_CUST_ITEM ar_cust_mast.NOT_USED_3 ar_cust_mast.ASSIGNED_DATE ar_cust_mast.LEAD_SOURCE ar_cust_mast.OPENED_DATE ar_cust_mast.LAST_SALE_DATE ar_cust_mast.LAST_PMT_DATE ar_cust_mast.HIGH_BAL_DATE ar_cust_mast.LAST_DUN_DATE ar_cust_mast.TAX_EXEMPT_NUM ar_cust_mast.SHIP_VIA ar_cust_mast.UPS_ZONE ar_ship_to_addr.COMPANY ar_ship_to_addr.CUSTOMER_NUM ar_ship_to_addr.SHIP_TO ar_ship_to_addr.SHIP_TO_NAME ar_ship_to_addr.SHIP_TO_ADDR_1 ar_ship_to_addr.SHIP_TO_ADDR_2 ar_ship_to_addr.SHIP_TO_ADDR_3 ar_ship_to_addr.CITY ar_ship_to_addr.STATE ar_ship_to_addr.ZIP_CODE sa_cust_item_cls.COMPANY sa_cust_item_cls.CUSTOMER_NUM sa_cust_item_cls.ITEM_CLASS sa_cust_item_cls.SHIP_TO sa_cust_item_cls.SALES_OLDEST_PD sa_cust_item_cls.SALES_PD_2 sa_cust_item_cls.SALES_PD_3 sa_cust_item_cls.SALES_PD_4 sa_cust_item_cls.SALES_PD_5 sa_cust_item_cls.SALES_PD_6 sa_cust_item_cls.SALES_PD_7 sa_cust_item_cls.SALES_PD_8 sa_cust_item_cls.SALES_PD_9 sa_cust_item_cls.SALES_PD_10 sa_cust_item_cls.SALES_PD_11 sa_cust_item_cls.SALES_PD_12 sa_cust_item_cls.SALES_PD_13 sa_cust_item_cls.SALES_PD_14 sa_cust_item_cls.SALES_PD_15 sa_cust_item_cls.SALES_PD_16 sa_cust_item_cls.SALES_PD_17 sa_cust_item_cls.SALES_PD_18 sa_cust_item_cls.SALES_PD_19 sa_cust_item_cls.SALES_PD_20 sa_cust_item_cls.SALES_PD_21 sa_cust_item_cls.SALES_PD_22 sa_cust_item_cls.SALES_PD_23 sa_cust_item_cls.SALES_PD_24 sa_cust_item_cls.SALES_PD_25 sa_cust_item_cls.SALES_LAST_PD_26 sa_cust_item_cls.SALES_CURR sa_cust_item_cls.COST_OLDEST_PD sa_cust_item_cls.COST_PD_2 sa_cust_item_cls.COST_PD_3 sa_cust_item_cls.COST_PD_4 sa_cust_item_cls.COST_PD_5 sa_cust_item_cls.COST_PD_6 sa_cust_item_cls.COST_PD_7 sa_cust_item_cls.COST_PD_8 sa_cust_item_cls.COST_PD_9 sa_cust_item_cls.COST_PD_10 sa_cust_item_cls.COST_PD_11 sa_cust_item_cls.COST_PD_12 sa_cust_item_cls.COST_PD_13 sa_cust_item_cls.COST_PD_14 sa_cust_item_cls.COST_PD_15 sa_cust_item_cls.COST_PD_16 sa_cust_item_cls.COST_PD_17 sa_cust_item_cls.COST_PD_18 sa_cust_item_cls.COST_PD_19 sa_cust_item_cls.COST_PD_20 sa_cust_item_cls.COST_PD_21 sa_cust_item_cls.COST_PD_22 sa_cust_item_cls.COST_PD_23 sa_cust_item_cls.COST_PD_24 sa_cust_item_cls.COST_PD_25 sa_cust_item_cls.COST_LAST_PD_26 sa_cust_item_cls.COST_CURR_PD_27 sa_cust_item_cls.NOT_USED_1 01 1273 company name 112 test drive 112 test drive, cityname, st 37429 cityname st 37429 555-555-5555 555-555-5355 my name my other name my e-mail my city, st SAME DLR BP NT AR H 3 2 ALL 0 0 7232.86 5506 20932.11 16319.24 566.97 7425.21 1250 0 15 N Y Y D Y Y Y 1 0 0 0 15 546 Y 0 P N Y N B DLR 2003-11-14 2011-06-30 2011-07-11 2008-07-01 1997-11-19 UPS GROUND 2 01 1273 1 my company 113 test dr my city, st my city st 24842 1273 YKP S 13 0 0 0 0 0 0 0 0 0 13 0 64 0 0 0 0 9 0 32 0 0 0 10 0 0 0 10 0 0 0 0 0 0 0 0 0 10 0 46 0 0 0 0 6 0 18 0 0 0 7 0 0 0 01 1273 company name 113 test drive 113 test drive, cityname, st 37429 cityname st 37429 555-555-5555 555-555-5355 my name my other name my e-mail my city, st SAME DLR BP NT AR H 3 2 ALL 0 0 7232.86 5506 20932.11 16319.24 566.97 7425.21 1250 0 15 N Y Y D Y Y Y 1 0 0 0 15 546 Y 0 P N Y N B DLR 2003-11-14 2011-06-30 2011-07-11 2008-07-01 1997-11-19 UPS GROUND 2 01 1273 1 my company 114 test dr my city, st my city st 24842 1273 YKT S 0 0 0 0 0 0 0 0 0 0 0 214 214 -214 0 0 0 0 0 0 0 0 0 0 0 486 0 0 0 0 0 0 0 0 0 0 0 0 141 158 -141 0 0 0 0 0 0 0 0 0 0 0 360 0 01 1273 company name 114 test drive 114 test drive, cityname, st 37429 cityname st 37429 555-555-5555 555-555-5355 my name my other name my e-mail my city, st SAME DLR BP NT AR H 3 2 ALL 0 0 7232.86 5506 20932.11 16319.24 566.97 7425.21 1250 0 15 N Y Y D Y Y Y 1 0 0 0 15 546 Y 0 P N Y N B DLR 2003-11-14 2011-06-30 2011-07-11 2008-07-01 1997-11-19 UPS GROUND 2 01 1273 1 my company 115 test dr my city, st my city st 24842 1273 YKU S 0 0 0 0 0 0 0 0 0 923 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 697 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  7. cust_mast.CUSTOMER_NUM is the customer number column. Each table has a column with the customer number in it. However, when getting the totals, the customer's number may be listed in sa_cust_item_cls three times since their are three categories per customer. customer1 'YKT' sales period 1 sales period 2 sales period 3 etc... customer1 'YKP' sales period 1 sales period 2 sales period 3 etc... customer1 'YKU' sales period 1 sales period 2 sales period 3 etc... customer2 'YKT' sales period 1 sales period 2 sales period 3 etc... customer2 'YKP' sales period 1 sales period 2 sales period 3 etc... customer2 'YKU' sales period 1 sales period 2 sales period 3 etc... I want the total of all the sales periods and all three categories per customer. If the customers total sales for those three categories are not >=500, then I do not want it to select the customers information I want it to only select the customers whose sales for those three categories are 500 or greater.
  8. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU' at line 15 SELECT * FROM ar_cust_mast LEFT JOIN ar_ship_to_addr ON ar_cust_mast.CUSTOMER_NUM = ar_ship_to_addr.CUSTOMER_NUM LEFT JOIN sa_cust_item_cls ON ar_cust_mast.CUSTOMER_NUM = sa_cust_item_cls.CUSTOMER_NUM WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.ACTIVE='Y' AND ar_cust_mast.CUSTOMER_CLASS<>'RET' AND ar_cust_mast.CUSTOMER_CLASS<>'REF' AND ar_cust_mast.CUSTOMER_CLASS<>'GCA' AND ar_cust_mast.CUSTOMER_CLASS<>'OUT' AND ar_cust_mast.CUSTOMER_CLASS<>'REC' AND ar_cust_mast.CUSTOMER_CLASS<>'SSC' AND ar_cust_mast.CUSTOMER_CLASS<>'WHS' AND ar_cust_mast.CUSTOMER_CLASS<>'SDD' AND (SELECT sa_cust_item_cls.SALES_OLDEST_PD + sa_cust_item_cls.SALES_PD_2 + sa_cust_item_cls.SALES_PD_3 + sa_cust_item_cls.SALES_PD_4 + sa_cust_item_cls.SALES_PD_5 + sa_cust_item_cls.SALES_PD_6 + sa_cust_item_cls.SALES_PD_7 + sa_cust_item_cls.SALES_PD_8 + sa_cust_item_cls.SALES_PD_9 + sa_cust_item_cls.SALES_PD_10 + sa_cust_item_cls.SALES_PD_11 + sa_cust_item_cls.SALES_PD_12 + sa_cust_item_cls.SALES_PD_13 + sa_cust_item_cls.SALES_PD_14 + sa_cust_item_cls.SALES_PD_15 + sa_cust_item_cls.SALES_PD_16 + sa_cust_item_cls.SALES_PD_17 + sa_cust_item_cls.SALES_PD_18 + sa_cust_item_cls.SALES_PD_19 + sa_cust_item_cls.SALES_PD_20 + sa_cust_item_cls.SALES_PD_21 + sa_cust_item_cls.SALES_PD_22 + sa_cust_item_cls.SALES_PD_23 + sa_cust_item_cls.SALES_PD_24 + sa_cust_item_cls.SALES_PD_25 + sa_cust_item_cls.SALES_LAST_PD_26 + sa_cust_item_cls.SALES_CURR AS period_totals WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.CUSTOMER_NUM = sa_cust_item_cls.CUSTOMER_NUM) period_totals >= '500';
  9. I have not added it yet. I am trying to figure it out. How can I add the columns of the three categories together per customer and then determine whether it is selected or not based on if the complete total is 500 or more?
  10. This is what I am wanting to add to my main query. Where this total is greater than 500 it will retrieve the rows. SELECT sa_cust_item_cls.SALES_OLDEST_PD + sa_cust_item_cls.SALES_PD_2 + sa_cust_item_cls.SALES_PD_3 + sa_cust_item_cls.SALES_PD_4 + sa_cust_item_cls.SALES_PD_5 + sa_cust_item_cls.SALES_PD_6 + sa_cust_item_cls.SALES_PD_7 + sa_cust_item_cls.SALES_PD_8 + sa_cust_item_cls.SALES_PD_9 + sa_cust_item_cls.SALES_PD_10 + sa_cust_item_cls.SALES_PD_11 + sa_cust_item_cls.SALES_PD_12 + sa_cust_item_cls.SALES_PD_13 + sa_cust_item_cls.SALES_PD_14 + sa_cust_item_cls.SALES_PD_15 + sa_cust_item_cls.SALES_PD_16 + sa_cust_item_cls.SALES_PD_17 + sa_cust_item_cls.SALES_PD_18 + sa_cust_item_cls.SALES_PD_19 + sa_cust_item_cls.SALES_PD_20 + sa_cust_item_cls.SALES_PD_21 + sa_cust_item_cls.SALES_PD_22 + sa_cust_item_cls.SALES_PD_23 + sa_cust_item_cls.SALES_PD_24 + sa_cust_item_cls.SALES_PD_25 + sa_cust_item_cls.SALES_LAST_PD_26 + sa_cust_item_cls.SALES_CURR AS period_totals WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.CUSTOMER_NUM = sa_cust_item_cls.CUSTOMER_NUM Main Query SELECT * FROM ar_cust_mast LEFT JOIN ar_ship_to_addr ON ar_cust_mast.CUSTOMER_NUM = ar_ship_to_addr.CUSTOMER_NUM WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.ACTIVE='Y' AND ar_cust_mast.CUSTOMER_CLASS<>'RET' AND ar_cust_mast.CUSTOMER_CLASS<>'REF' AND ar_cust_mast.CUSTOMER_CLASS<>'GCA' AND ar_cust_mast.CUSTOMER_CLASS<>'OUT' AND ar_cust_mast.CUSTOMER_CLASS<>'REC' AND ar_cust_mast.CUSTOMER_CLASS<>'SSC' AND ar_cust_mast.CUSTOMER_CLASS<>'WHS' AND ar_cust_mast.CUSTOMER_CLASS<>'SDD'; Basically I only want the customers whose sales in categories YKU,YKT,and YKP are greater than 500 for the total of the sales periods. And I am appending the shipping address table so I can get the customers shipping addresses in the process.
  11. This should have said I am joining Customer Mater and Customer Ship Address Table. The Customer Class table is the one that has all the periods in it.
  12. I am joining two tables together. Customer Master and Customer Sales By Class. The Customer Class table is filled with customer numbers, categories, and sales periods. I would like the total of the sales periods and categories (YKP,YKU,YKT). If the the total of the periods and three categories for the customer is >= 500 it will grab the row. Thanks, Jake PERIODS sa_cust_item_cls.SALES_OLDEST_PD sa_cust_item_cls.SALES_PD_2 sa_cust_item_cls.SALES_PD_3 sa_cust_item_cls.SALES_PD_4 sa_cust_item_cls.SALES_PD_5 sa_cust_item_cls.SALES_PD_6 sa_cust_item_cls.SALES_PD_7 sa_cust_item_cls.SALES_PD_8 sa_cust_item_cls.SALES_PD_9 sa_cust_item_cls.SALES_PD_10 sa_cust_item_cls.SALES_PD_11 sa_cust_item_cls.SALES_PD_12 sa_cust_item_cls.SALES_PD_13 sa_cust_item_cls.SALES_PD_14 sa_cust_item_cls.SALES_PD_15 sa_cust_item_cls.SALES_PD_16 sa_cust_item_cls.SALES_PD_17 sa_cust_item_cls.SALES_PD_18 sa_cust_item_cls.SALES_PD_19 sa_cust_item_cls.SALES_PD_20 sa_cust_item_cls.SALES_PD_21 sa_cust_item_cls.SALES_PD_22 sa_cust_item_cls.SALES_PD_23 sa_cust_item_cls.SALES_PD_24 sa_cust_item_cls.SALES_PD_25 sa_cust_item_cls.SALES_LAST_PD_26 sa_cust_item_cls.SALES_CURR CURRENT QUERY SO FAR SELECT * FROM ar_cust_mast LEFT JOIN ar_ship_to_addr ON ar_cust_mast.CUSTOMER_NUM = ar_ship_to_addr.CUSTOMER_NUM WHERE (sa_cust_item_cls.ITEM_CLASS = 'YKP' or sa_cust_item_cls.ITEM_CLASS = 'YKU'or sa_cust_item_cls.ITEM_CLASS = 'YKT') AND ar_cust_mast.ACTIVE='Y' AND ar_cust_mast.CUSTOMER_CLASS<>'RET' AND ar_cust_mast.CUSTOMER_CLASS<>'REF' AND ar_cust_mast.CUSTOMER_CLASS<>'GCA' AND ar_cust_mast.CUSTOMER_CLASS<>'OUT' AND ar_cust_mast.CUSTOMER_CLASS<>'REC' AND ar_cust_mast.CUSTOMER_CLASS<>'SSC' AND ar_cust_mast.CUSTOMER_CLASS<>'WHS' AND ar_cust_mast.CUSTOMER_CLASS<>'SDD';
  13. TOTAL WAS 79313 AFTER QUERY WAS 75327 It is right. We added a couple of new product lines. I did not realize how many parts that consisted of. Thanks, Jake
  14. Still not returning the correct rows. One time it returned about 35,000..... I ran it again and the next query was back up at 75,000. SELECT * FROM table WHERE Cls IN ( 'P27', 'O34', 'P08', 'R01', 'R02', 'R33', 'O26', 'O27', 'W30', 'P45', 'R09', 'BBL', 'BBM', 'P15', 'R12', 'P75', 'P65', 'P80', 'R17', 'P79', 'P40', 'P90', 'P91', 'P92', 'P93', 'P94', 'P95', 'P96', 'P97', 'P98', 'P99', 'R14', 'R15', 'R16', 'P59', 'O43', 'B02', 'P81', 'GLO', 'CAA', 'CAB', 'P02', 'CAT', 'CAW', 'CAY', 'CAR', 'CAS', 'CAX', 'CAZ', 'R38', 'P49', 'R22', 'O31', 'P56', 'R39', 'SAW', 'O18', 'O19', 'O20', 'O21', 'O22', 'O23', 'O24', 'O25', 'O28', 'O29', 'O30', 'R35', 'W20', 'W21', 'W25', 'O07', 'O09', 'O10', 'O11', 'O12', 'O13', 'R36', 'W12', 'W11', 'LTO', 'P84', 'P48', 'P46', 'P60', 'R03', 'R10', 'P76', 'R05', 'P51', 'P41', 'E20', 'P33', 'P47', 'P53', 'P74', 'R23', 'SUN', 'P04', 'P30', 'P83', 'R19', 'P07', 'R20', 'BTY', 'BTZ', 'EAG', 'P36', 'P50', 'R04', 'P86', 'R28', 'GW7', 'GW3', 'GW6', 'GW4', 'GW2', 'GW5', 'GW1', 'O45', 'O44', 'HDA', 'HFI', 'HHO', ' IG', 'R31', 'J01', 'J05', 'J10', ' LG', 'LTP', 'LOG', 'DIX', 'GAP', 'LTQ', 'PNT', 'M20', 'MSC', 'P52', 'P87', 'SUP', 'TBP', 'P35', 'R18', 'OPT', 'P54', 'O46', 'PRK', 'P37', 'R48', 'O36', 'LPA', 'LPF', 'LPG', 'LPU', 'R13', 'P34', 'P44', 'P78', 'P82', 'P32', 'R11', 'ELV', 'O35', 'SFT', 'SFY', 'W46', 'O01', 'O02', 'O03', 'O04', 'O05', 'O06', 'R34', 'W01', 'W02', 'W03', 'W05', 'P73', 'R21', 'P85', 'O00', 'O32', 'O52', 'P88', 'W32', 'P57', 'SDP', 'SLM', 'R41', 'NGK', 'P77', 'R24', 'O61', 'SPA', 'SPE', 'P05', 'P43', 'R26', 'R37', 'P31', 'R25', 'R29', 'P67', 'P58', 'P68', 'P70', 'R08', 'HWR', 'O33', 'P42', 'R32', 'P61', 'EDP', 'EDR', 'O42', 'P19', 'P20', 'P21', 'P22', 'P23', 'O40', 'R27', 'P55', 'TRU', 'P71', 'B03', 'P09', 'WEL', 'P72', 'R06', 'R07', 'W43', 'YKP', 'P06', 'E00', 'LTA', 'M00', 'M01', 'M02', 'M03', 'MO9', 'M10', 'M11', 'SDA', 'SDL', 'SUL', 'TBA')
  15. I am having trouble getting this query to filter my rows. There are about 75,000 total and only about 45,000 should be selected. I tried using this IN and using the OR and I could not get either to work. IN SELECT * FROM table WHERE `Cls` IN('P27','O34','P08','R01','R02','R33','O26','O27',' W30','P45','R09','BBL','BBM','P15','R12','P75','P65','P80','R17','P79','P40','P90', 'P91','P92','P93','P94','P95','P96','P97','P98','P99','R14','R15','R16','P59','O43', 'B02','P81','GLO','CAA','CAB','P02','CAT','CAW','CAY','CAR','CAS','CAX','CAZ','R38', 'P49','R22','O31','P56','R39','SAW','O18','O19','O20','O21','O22','O23','O24','O25', 'O28','O29','O30','R35','W20','W21','W25','O07','O09','O10','O11','O12','O13','R36', 'W12','W11','LTO','P84','P48','P46','P60','R03','R10','P76','R05','P51','P41','E20', 'P33','P47','P53','P74','R23','SUN','P04','P30','P83','R19','P07','R20','BTY','BTZ', 'EAG','P36','P50','R04','P86','R28','GW7','GW3','GW6','GW4','GW2','GW5','GW1','O45', 'O44','HDA','HFI','HHO',' IG','R31','J01','J05','J10',' LG','LTP','LOG','DIX','GAP', 'LTQ','PNT','M20','MSC','P52','P87','SUP','TBP','P35','R18','OPT','P54','O46','PRK', 'P37','R48','O36','LPA','LPF','LPG','LPU','R13','P34','P44','P78','P82','P32','R11', 'ELV','O35','SFT','SFY','W46','O01','O02','O03','O04','O05','O06','R34','W01','W02', 'W03','W05','P73','R21','P85','O00','O32','O52','P88','W32','P57','SDP','SLM','R41', 'NGK','P77','R24','O61','SPA','SPE','P05','P43','R26','R37','P31','R25','R29','P67', 'P58','P68','P70','R08','HWR','O33','P42','R32','P61','EDP','EDR','O42','P19','P20', 'P21','P22','P23','O40','R27','P55','TRU','P71','B03','P09','WEL','P72','R06','R07', 'W43','YKP','P06','E00','LTA','M00','M01','M02','M03','MO9','M10','M11','SDA','SDL', 'SUL','TBA') OR SELECT * FROM table WHERE Cls ='P27'OR Cls ='O34'OR Cls ='P08'OR Cls ='R01'OR Cls ='R02'OR Cls ='R33'OR Cls ='O26'OR Cls ='O27'OR Cls ='W30'OR Cls ='P45'OR Cls ='R09'OR Cls ='BBL'OR Cls ='BBM'OR Cls ='P15'OR Cls ='R12'OR Cls ='P75'OR Cls ='P65'OR Cls ='P80'OR Cls ='R17'OR Cls ='P79'OR Cls ='P40'OR Cls ='P90'OR Cls ='P91'OR Cls ='P92'OR Cls ='P93'OR Cls ='P94'OR Cls ='P95'OR Cls ='P96'OR Cls ='P97'OR Cls ='P98'OR Cls ='P99'OR Cls ='R14'OR Cls ='R15'OR Cls ='R16'OR Cls ='P59'OR Cls ='O43'OR Cls ='B02'OR Cls ='P81'OR Cls ='GLO'OR Cls ='CAA'OR Cls ='CAB'OR Cls ='P02'OR Cls ='CAT'OR Cls ='CAW'OR Cls ='CAY'OR Cls ='CAR'OR Cls ='CAS'OR Cls ='CAX'OR Cls ='CAZ'OR Cls ='R38'OR Cls ='P49'OR Cls ='R22'OR Cls ='O31'OR Cls ='P56'OR Cls ='R39'OR Cls ='SAW'OR Cls ='O18'OR Cls ='O19'OR Cls ='O20'OR Cls ='O21'OR Cls ='O22'OR Cls ='O23'OR Cls ='O24'OR Cls ='O25'OR Cls ='O28'OR Cls ='O29'OR Cls ='O30'OR Cls ='R35'OR Cls ='W20'OR Cls ='W21'OR Cls ='W25'OR Cls ='O07'OR Cls ='O09'OR Cls ='O10'OR Cls ='O11'OR Cls ='O12'OR Cls ='O13'OR Cls ='R36'OR Cls ='W12'OR Cls ='W11'OR Cls ='LTO'OR Cls ='P84'OR Cls ='P48'OR Cls ='P46'OR Cls ='P60'OR Cls ='R03'OR Cls ='R10'OR Cls ='P76'OR Cls ='R05'OR Cls ='P51'OR Cls ='P41'OR Cls ='E20'OR Cls ='P33'OR Cls ='P47'OR Cls ='P53'OR Cls ='P74'OR Cls ='R23'OR Cls ='SUN'OR Cls ='P04'OR Cls ='P30'OR Cls ='P83'OR Cls ='R19'OR Cls ='P07'OR Cls ='R20'OR Cls ='BTY'OR Cls ='BTZ'OR Cls ='EAG'OR Cls ='P36'OR Cls ='P50'OR Cls ='R04'OR Cls ='P86'OR Cls ='R28'OR Cls ='GW7'OR Cls ='GW3'OR Cls ='GW6'OR Cls ='GW4'OR Cls ='GW2'OR Cls ='GW5'OR Cls ='GW1'OR Cls ='O45'OR Cls ='O44'OR Cls ='HDA'OR Cls ='HFI'OR Cls ='HHO'OR Cls =' IG'OR Cls ='R31'OR Cls ='J01'OR Cls ='J05'OR Cls ='J10'OR Cls =' LG'OR Cls ='LTP'OR Cls ='LOG'OR Cls ='DIX'OR Cls ='GAP'OR Cls ='LTQ'OR Cls ='PNT'OR Cls ='M20'OR Cls ='MSC'OR Cls ='P52'OR Cls ='P87'OR Cls ='SUP'OR Cls ='TBP'OR Cls ='P35'OR Cls ='R18'OR Cls ='OPT'OR Cls ='P54'OR Cls ='O46'OR Cls ='PRK'OR Cls ='P37'OR Cls ='R48'OR Cls ='O36'OR Cls ='LPA'OR Cls ='LPF'OR Cls ='LPG'OR Cls ='LPU'OR Cls ='R13'OR Cls ='P34'OR Cls ='P44'OR Cls ='P78'OR Cls ='P82'OR Cls ='P32'OR Cls ='R11'OR Cls ='ELV'OR Cls ='O35'OR Cls ='SFT'OR Cls ='SFY'OR Cls ='W46'OR Cls ='O01'OR Cls = 'O02'OR Cls ='O03'OR Cls ='O04'OR Cls ='O05'OR Cls ='O06'OR Cls ='R34'OR Cls ='W01'OR Cls ='W02'OR Cls ='W03'OR Cls ='W05'OR Cls ='P73'OR Cls ='R21'OR Cls ='P85'OR Cls = 'O00'OR Cls ='O32'OR Cls ='O52'OR Cls ='P88'OR Cls ='W32'OR Cls ='P57'OR Cls ='SDP'OR Cls ='SLM'OR Cls ='R41'OR Cls ='NGK'OR Cls ='P77'OR Cls ='R24'OR Cls ='O61'OR Cls = 'SPA'OR Cls ='SPE'OR Cls ='P05'OR Cls ='P43'OR Cls ='R26'OR Cls ='R37'OR Cls ='P31'OR Cls ='R25'OR Cls ='R29'OR Cls ='P67'OR Cls ='P58'OR Cls ='P68'OR Cls ='P70'OR Cls = 'R08'OR Cls ='HWR'OR Cls ='O33'OR Cls ='P42'OR Cls ='R32'OR Cls ='P61'OR Cls ='EDP'OR Cls ='EDR'OR Cls ='O42'OR Cls ='P19'OR Cls ='P20'OR Cls ='P21'OR Cls ='P22'OR Cls = 'P23'OR Cls ='O40'OR Cls ='R27'OR Cls ='P55'OR Cls ='TRU'OR Cls ='P71'OR Cls ='B03'OR Cls ='P09'OR Cls ='WEL'OR Cls ='P72'OR Cls ='R06'OR Cls ='R07'OR Cls ='W43'OR Cls = 'YKP'OR Cls ='P06'OR Cls ='E00'OR Cls ='LTA'OR Cls ='M00'OR Cls ='M01'OR Cls ='M02'OR Cls ='M03'OR Cls ='MO9'OR Cls ='M10'OR Cls ='M11'OR Cls ='SDA'OR Cls ='SDL'OR Cls = 'SUL'OR Cls ='TBA'
  16. 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
  17. 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 } } ?>
  18. 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
  19. 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
  20. 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 ''
  21. MySQL ERROR: Incorrect date value: '' for column 'OPENED_DATE' at row 1 The columns are set to allow null. Jake
  22. MySQL ERROR: Incorrect date value: '' for column 'OPENED_DATE' at row 1
  23. 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'];
  24. nevermind... I was just going to fast. My queries were not even right. I was getting ahead of myself.
  25. 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); } } ?>
×
×
  • 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.