close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to generate multiple .zip file in a loop base on a filtered result in array

Thread began 4/17/2022 10:46 pm by Rokon | Last modified 4/19/2022 7:38 am by Ray Borduin | 369 views | 6 replies |

Rokon

How to generate multiple .zip file in a loop base on a filtered result in array

Dear Ray

I need your support here where my position is I need to create multiple .zip file as output from a query result base on their respected ID which is in array. In this below query $filterHadithBooks I am filtering out the BookID which is like 10,12,13,14 so on.

Now from the query $mainHadith I need to filtered out the data of the respected book and output as .zip file. As there are several books data over there so when I should run the php file then it should generate the zip file in a row like hb10.zip, hb12.zip, hb13.zip .. and at the end it will stop after all file generation is complete.

I am attaching the php file herewith. Thanks for your kind co-operation.

Sign in to reply to this post

Ray BorduinWebAssist

This is beyond the scope of what I can do in the forums. I'm not even sure where you are stuck. If you have a specific question then I can try to answer it, but if you want me to build your application for you, we would need to schedule a premier support ticket.

Sign in to reply to this post
Did this help? Tips are appreciated...

Rokon

Originally Said By: Ray Borduin
  This is beyond the scope of what I can do in the forums. I'm not even sure where you are stuck. If you have a specific question then I can try to answer it, but if you want me to build your application for you, we would need to schedule a premier support ticket.  



Dear Ray, I got your point. I am actually stuck on a position where all the BookID should split from $filterHadithBooks query and loop through one after another for filtering the data from $mainHadith query. With the below query I can see that only one file is generating in output.


php:
<?php

$filterHadithBooks 
= new WA_MySQLi_RS("filterHadithBooks",$hadithbd,0);
$filterHadithBooks->setQuery("SELECT hadithbook.BookID FROM hadithbook WHERE hadithbook.Active = 1 ORDER BY hadithbook.priority ASC");
$filterHadithBooks->execute();
?>
<?php
while (!$filterHadithBooks->atEnd()) {
?>
<?php
$mainHadith 
= new WA_MySQLi_RS("mainHadith",$hadithbd,0);
$mainHadith->setQuery("SELECT hadithmain.HadithID AS hadithID, hadithmain.HadithNo AS hadithNumber, hadithmain.hadithNo2 AS hadithNumber2, hadithmain.hadithNo3 AS hadithNumber3, hadithmain.ArabicHadith AS arabicHadithTashkeel, hadithmain.ArabicHadithNew AS arabicHadithNoTashkeel, hadithmain.BanglaHadith AS banglaHadith, hadithmain.EnglishHadith AS englishHadith, hadithmain.HadithNote, hadithbook.BookNameBD AS bookNameBangla, hadithchapter.ChapterBG AS hadithChapterBangla, hadithchapter.ChapterAR AS hadithChapterArabic, hadithchapter.ChapterEN AS hadithChapterEnglish, hadithexplanation.explanation AS hadithExplanation, hadithlearning.hadithinfo AS learningFromHadith, hadithstatus.StatusID, hadithstatus.StatusBG, rabihadith.rabiBangla, hadithsection.SectionBD FROM hadithmain LEFT OUTER JOIN hadithbook ON hadithmain.BookID = hadithbook.BookID LEFT OUTER JOIN hadithchapter ON hadithmain.chapterID = hadithchapter.chapID LEFT OUTER JOIN hadithexplanation ON hadithmain.HadithID = hadithexplanation.hadithID LEFT OUTER JOIN hadithlearning ON hadithmain.HadithID = hadithlearning.hadithID LEFT OUTER JOIN hadithstatus ON hadithmain.HadithStatus = hadithstatus.StatusID LEFT OUTER JOIN rabihadith ON hadithmain.RabiID = rabihadith.rabiID LEFT OUTER JOIN hadithsection ON hadithmain.SectionID = hadithsection.SectionID WHERE hadithmain.HadithActive = 1 AND hadithmain.BookID = ? ORDER BY hadithmain.HadithNo ASC");
$mainHadith->bindParam("i""".($filterHadithBooks->getColumnVal("BookID"))  ."""-1"); //WAQB_Param1
$mainHadith->execute();
?>
<?php
  $filterHadithBooks
->Results[$filterHadithBooks->Index];
  
$filterHadithBooks->moveNext();
}
?>
Sign in to reply to this post

Ray BorduinWebAssist

I think you need another while loop for the $mainHadith recordset results.

Sign in to reply to this post
Did this help? Tips are appreciated...

Rokon

Originally Said By: Ray Borduin
  I think you need another while loop for the $mainHadith recordset results.  



Am I doing right or wrong, I am confused as I am getting Fatal error: Out of memory error. Pls help.

php:
<?php

require_once('../Connections/hadithbd.php'); ?>
<?php 
require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
$filterHadithBooks 
= new WA_MySQLi_RS("filterHadithBooks",$hadithbd,0);
$filterHadithBooks->setQuery("SELECT hadithbook.BookID FROM hadithbook WHERE hadithbook.Active = 1 ORDER BY hadithbook.priority ASC");
$filterHadithBooks->execute();
?>
<?php
while (!$filterHadithBooks->atEnd()) {
?>
<?php
$mainHadith 
= new WA_MySQLi_RS("mainHadith",$hadithbd,0);
$mainHadith->setQuery("SELECT hadithmain.HadithID AS hadithID, hadithmain.HadithNo AS hadithNumber, hadithmain.hadithNo2 AS hadithNumber2, hadithmain.hadithNo3 AS hadithNumber3, hadithmain.ArabicHadith AS arabicHadithTashkeel, hadithmain.ArabicHadithNew AS arabicHadithNoTashkeel, hadithmain.BanglaHadith AS banglaHadith, hadithmain.EnglishHadith AS englishHadith, hadithmain.HadithNote, hadithbook.BookNameBD AS bookNameBangla, hadithchapter.ChapterBG AS hadithChapterBangla, hadithchapter.ChapterAR AS hadithChapterArabic, hadithchapter.ChapterEN AS hadithChapterEnglish, hadithexplanation.explanation AS hadithExplanation, hadithlearning.hadithinfo AS learningFromHadith, hadithstatus.StatusID, hadithstatus.StatusBG, rabihadith.rabiBangla, hadithsection.SectionBD FROM hadithmain LEFT OUTER JOIN hadithbook ON hadithmain.BookID = hadithbook.BookID LEFT OUTER JOIN hadithchapter ON hadithmain.chapterID = hadithchapter.chapID LEFT OUTER JOIN hadithexplanation ON hadithmain.HadithID = hadithexplanation.hadithID LEFT OUTER JOIN hadithlearning ON hadithmain.HadithID = hadithlearning.hadithID LEFT OUTER JOIN hadithstatus ON hadithmain.HadithStatus = hadithstatus.StatusID LEFT OUTER JOIN rabihadith ON hadithmain.RabiID = rabihadith.rabiID LEFT OUTER JOIN hadithsection ON hadithmain.SectionID = hadithsection.SectionID WHERE hadithmain.HadithActive = 1 AND hadithmain.BookID = ? ORDER BY hadithmain.HadithNo ASC");
$mainHadith->bindParam("i""".($filterHadithBooks->getColumnVal("BookID"))  ."""-1"); //WAQB_Param1
$mainHadith->execute();
?>
<?php
while (!$mainHadith->atEnd()) {
?>
<?php
  $filterHadithBooks
->Results[$filterHadithBooks->Index]["Book"] = $mainHadith->Results;
  
$filterHadithBooks->moveNext();
}
?>
<?php
  $mainHadith
->Results;
  
$mainHadith->moveNext();
}
?>

<?php
header
("Content-Type: application/json; charset=UTF-8");
$json json_encode($mainHadith->ResultsJSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);

?>
Sign in to reply to this post

Ray BorduinWebAssist

I think this:

php:
<?php

  $filterHadithBooks
->Results[$filterHadithBooks->Index]["Book"] = $mainHadith->Results;
  
$filterHadithBooks->moveNext();
}
?>
<?php
  $mainHadith
->Results;
  
$mainHadith->moveNext();
}
?>



Should be:

php:
<?php

  $mainHadith
->moveNext();
}
?>
<?php
  $filterHadithBooks
->moveNext();
}
?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Rokon

Originally Said By: Ray Borduin
  I think this:
php:
<?php

  $filterHadithBooks
->Results[$filterHadithBooks->Index]["Book"] = $mainHadith->Results;
  
$filterHadithBooks->moveNext();
}
?>
<?php
  $mainHadith
->Results;
  
$mainHadith->moveNext();
}
?>


Should be:
php:
<?php

  $mainHadith
->moveNext();
}
?>
<?php
  $filterHadithBooks
->moveNext();
}
?>
  


Thanks a lot Ray, It works!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...