Hi
Really racking my brain on what i need to do here:
I am using the file reader and ned to know how i clear the memory out so that i can re-use it.
$zip = zip_open("$file_name");
if ($zip){
while ($zip_entry = zip_read($zip)){
$zip_size = 0;
$zip_size = zip_entry_filesize($zip_entry);
echo ' '.$zip_size.'<br>';
if (zip_entry_open($zip, $zip_entry)){
$contents = zip_entry_read($zip_entry, $zip_size);
$datapool = $contents;
// now loop through and explode it and add it
$lines = explode("\n", $datapool); // note you might have to do \r\n else you'll end up with the dummy character in teh last item of the row
foreach($lines as $value){
$pieces2 = explode(",", $value);
// assign the array values ready for check and input
$mer_id = $pieces2[0];
$name = $pieces2[1];
$aw_id = $pieces2[2];
$prod_name = $pieces2[3];
$cats = $pieces2[4];
$deeplink = $pieces2[5];
$image = $pieces2[6];
$fee = $pieces2[7];
$delivery = $pieces2[8];
$stock = $pieces2[9];
$rrp = $pieces2[10];
$valid_to = $pieces2[11];
$details = 'This is where we would have lots of content and all the details about the merchants and product etc';
//$details = $pieces[7];
//now check that the email hasnt been entered before with a duplicate
if($fee>"0.01"){
$q = "SELECT * FROM $tablename WHERE aw_id='$aw_id'";
$qr = mysql_query($q);
$qrn = mysql_num_rows($qr);
if($qrn<"1"){
//new products
$i = ++$i;
$insq = "INSERT INTO $tablename
(name, aw_img, aw_deeplink, prod_name, cat, fee, aw_id, mer_id, delivery, in_stock, valid_to, rrp, details, last_update)
VALUES
('$name', '$image', '$deeplink', '$prod_name', '$cats', '$fee', '$aw_id', '$mer_id', '$delivery', '$stock', '$valid_to', '$rrp', '$details', '$timestamp')";
$insr = mysql_query($insq);
}else{
//its a dupe
$ud = "UPDATE $tablename SET name='$name', aw_img='$image', aw_deeplink='$deeplink', prod_name='$prod_name', cat='$cats', fee='$fee', aw_id='$aw_id', mer_id='$mer_id', delivery='$delivery', in_stock='$stock', valid_to='$valid_to', rrp='$rrp', details='$details', last_update='$timestamp' WHERE aw_id='$aw_id'";
$udr = mysql_query($ud);
$b = ++$b;
}
}else{
$ig = ++$ig;
}
}
zip_entry_close($zip_entry);
}
}
zip_close($zip);
//delete zip file
unlink($file_name);
}
this gives this output:
Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 7136978 bytes) in /web/public_html/zip.php on line 39
How do i empty out the memory as basically it needs it as im looping ??