PHP Classes

Niger: Query MySQL to generate data exports

Recommend this page to a friend!
  Info   View files Example   View files View files (1)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 245 All time: 7,958 This week: 154Up
Version License PHP version Categories
niger_class_php 1.5GNU General Publi...5Databases


This class can query MySQL to generate data exports.

It can connect to MySQL using MySQLi and execute arbitrary queries.

It can create CSV files with data from database query results and have the files split when they exceed a given number of lines.


What is the best PHP export mysql to csv or excel class?
Export MySQL tables using PHP to Excel Ideally

What is the best PHP mysql report generator class?
How to generate report from MySQL data

PDO Class
I need a class to connect to my db (mysql). Now my code is a old

export mysql data to excel spreadsheet
export mysql data to excel csv or xls spreadsheet file

Generate XLS format
I need a package specialized the generation of XLS format file.

Import excel file (xlsx format) into mysql database
I need to import excel data into database

import ics files to mysql db

export xlsx files
I want to export database records in xlsx format

What is the best PHP export excel class?
Trying to export query to an Excel file

Picture of Hassane Moussa
  Performance   Level  
Name: Hassane Moussa <contact>
Classes: 10 packages by
Country: Niger Niger
Age: 39
All time rank: 21711 in Niger Niger
Week rank: 76 Up1 in Niger Niger Equal
Innovation award
Innovation award
Nominee: 2x

Winner: 1x



                                Using Functions of Niger Class
// ini_set("memory_limit","10500M");
// set_time_limit(600);
$limit = 100; // number of rows in the file
$extension = ".csv"; // Extension File : ex : .txt ; .xls; .xlsx; ...
$filename = "Niger"; // the file name
$nigerconnect = new Niger ('localhost', 'root', '', 'adventureworks'); // Create a new object Niger
$Resulats = $nigerconnect->ReqSQL('SELECT * FROM `address` '); // request SQL
if ($Resulats){
$i =0;
$j = 1 ;
    foreach (
$Resulats as $Valeur)
          if (
$nigerconnect->Modulo($i,$limit) ==0){
$newfile = $nigerconnect->CreatFile($filename,$extension,$j) ; // create new file
fputs($newfile, 'AddressID;AddressLine1;City'); // file header
fputs($newfile, "\r\n");
fputs($newfile, '"'.$Valeur[0].'";"'.$Valeur[1].'";"'.$Valeur[3].'"'); // put the data from database in the file
fputs($newfile, "\r\n");
               if (
$nigerconnect->Modulo($i,$limit) ==0){fclose($newfile);} // close file

} // foreach
echo "You succeed ! Congratulations.";
// if
else {
"You did not succeed.Check your sql!";

  Files folder image Files  
File Role Description
Accessible without login Plain text file UsingFunctionsOfNigerClass.php Example Example script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,958
This week:154Up