obewan Posted March 1, 2007 Share Posted March 1, 2007 I am crunching mysql data and was able to write some php in a conventional script as well as command line version that worked, but it was slow with less than 30 records taking about 45 seconds. Perl version took less than 5 or 10 seconds max. I have to process over 1200 records.....php hangs and times out. So I went with perl, calling it from php with exec(). Why the huge difference between php and perl - particularly when both are called form the command line? ??? Quote Link to comment Share on other sites More sharing options...
effigy Posted March 1, 2007 Share Posted March 1, 2007 - Are you sure there aren't any bugs in the PHP? - Have you tried both with maximum error reporting? - If the scripts are small enough, can you post the code from both along with some example data? Quote Link to comment Share on other sites More sharing options...
obewan Posted March 1, 2007 Author Share Posted March 1, 2007 <? $dweb =& new dWeb(); $db =& $dweb->dbConnect(); $uniqueOrders = array(); // holds unique lines $uniqueAccounts = array(); // holds unique lines $lName = array(); // holds unique lines $fName = array(); // holds unique lines $paymentT = array(); // holds unique lines $paymentA = array(); // holds unique lines $count = 0; $process = 0; $result = $db->query("SELECT Phone,Account,LastName,FirstName, PaymentType,PaymentAmount,ID FROM table1 WHERE PaymentDate = '$mydate' AND orders_id = 0"); // Always check that $result is not an error if (DB::isError($result)) { die ($result->getMessage()); } while ($row = $result->fetchRow()) { $result2 = $db->query("SELECT table2.reseller_orderid from table2 WHERE table2.omsCustomerid = '$row[1]' limit 1"); if($row2 = $result2->fetchRow()) { $myid = $row2[0]; // get result and update table1.orders_id $update =& $db->query("UPDATE table1 SET orders_id = $myid WHERE Phone = $row[0]"); }else{ $result3 = $db->query("SELECT table2.reseller_orderid from table2 WHERE table2.lead_telephone = '$row[0]' limit 1"); if($row3 = $result3->fetchRow()) { $myid = $row3[0]; // get result and update table1.orders_id $update =& $db->query("UPDATE table1 SET orders_id = $myid WHERE ID = $row[6]"); }else{ // collect info on the rows that fail to find an id array_push($uniqueOrders, $row[0]); array_push($uniqueAccounts, $row[1]); array_push($lName, $row[2]); array_push($fName, $row[3]); array_push($paymentT, $row[4]); array_push($paymentA, $row[5]); } } $result2->free(); } // end while $result->free(); ?> /* sample data "Customer Name" "Account Number" "Type" "AccessCardNumber" "Status" "PhoneNumber" "Owner" "Zip" "Start Date" "Disconnection Date" "Payment Name" "Reason Code" "PPC/Chargeback" "tom" "804" "REG" "0595" "xL" "5551212" "romulas" "<Null>" "11/11/2006" "11/20/2006" "CBPPC-1" "<Null>" "-180.00" "dick" "721" "REG" "0978" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "<Null>" "51" "0.00" "dick" "721" "REG" "0142" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "<Null>" "51" "0.00" "dick" "721" "REG" "0165" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "<Null>" "51" "0.00" "dick" "721" "REG" "0183" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "BONUS" "<Null>" "25.00" "dick" "721" "REG" "0183" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "ABONUS" "<Null>" "25.00" "dick" "721" "REG" "0183" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "RSP" "<Null>" "50.00" "dick" "721" "REG" "0183" "xT" "5551213" "romulas" "23098" "2/17/2007" "<Null>" "P1" "<Null>" "205.00" "harry" "345" "REG" "0441" "xT" "5551214" "romulas" "23638" "2/20/2007" "<Null>" "<Null>" "51" "0.00" "harry" "345" "REG" "0875" "xT" "5551214" "romulas" "23638" "2/20/2007" "<Null>" "QBONUS" "<Null>" "25.00" "harry" "345" "REG" "0875" "xT" "5551214" "romulas" "23638" "2/20/2007" "<Null>" "RSP" "<Null>" "50.00" "harry" "345" "REG" "0875" "xT" "5551214" "romulas" "23638" "2/20/2007" "<Null>" "P-1" "<Null>" "205.00" */ Quote Link to comment Share on other sites More sharing options...
craygo Posted March 1, 2007 Share Posted March 1, 2007 Are you just trying to echo records to the browser?? What are you trying to do?? Ray Quote Link to comment Share on other sites More sharing options...
effigy Posted March 1, 2007 Share Posted March 1, 2007 Please post the Perl as well for comparison. Quote Link to comment Share on other sites More sharing options...
obewan Posted March 1, 2007 Author Share Posted March 1, 2007 I am echoing records to the browser and using ajax for CRUD updating to fix ones without order id's Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.