troubleshooting Question

Linux box killing my script...

Avatar of blink10
blink10 asked on
6 Comments1 Solution289 ViewsLast Modified:
I trying to run a while loop to process my product's records.

However....I have about 8 million records and every time I try to run it, it just does nothing for 3 minutes and then just says killed.

Why does this while loop kill it? Below I have the code will is causing the problems....ideas on how to modify it? (when i limit it to 10 it runs ok)

I have a feeling it a memory issue, by why cant it process this number of records?

$resultp = mysql_query("SELECT * FROM LinkshareProducts WHERE P_Id<>''");

while($row = mysql_fetch_array($resultp)) {


//special scripting to get isbn number

$isbnLENGTN=strlen($isbn); // should be 10 or 13 long

$Name = mysql_real_escape_string($Name);

$pn = mysql_real_escape_string($mid);
$resultp1 = mysql_query("SELECT * FROM Stores WHERE MID='$pn'");
$row1 = mysql_fetch_array($resultp1);



$upcLENGTH=strlen($UPC); // should be 12 long




$Description = mysql_real_escape_string($Description);
$a1 = mysql_real_escape_string($a1);
$a2 = mysql_real_escape_string($a2);
$a3 = mysql_real_escape_string($a3);
$a4 = mysql_real_escape_string($a4);
$a5 = mysql_real_escape_string($a5);
$a6 = mysql_real_escape_string($a6);
$a7 = mysql_real_escape_string($a7);

$InStock = mysql_real_escape_string($InStock);

$t1 = mysql_real_escape_string($t1);
$t2 = mysql_real_escape_string($t2);

if ($Instock!="no"){
$Description = mysql_real_escape_string($Description);
$Brand = mysql_real_escape_string($Brand);
$Image = mysql_real_escape_string($Image);
$NewUsed = mysql_real_escape_string($NewUsed);
$manid = mysql_real_escape_string($manid);

mysql_query("INSERT INTO products (id, name, description, brand, image, NewUsed, tier1, tier2, source, a1, a2, a3, a4, a5, a6, a7, network) VALUES ('$id', '$Name', '$Description', '$Brand', '$Image', '$NewUsed', '$t1', '$t2', '$source', '$a1', '$a2', '$a3', '$a4', '$a5', '$a6', '$a7', '$network')")or die(mysql_error());
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros