Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_array_needed() {
- $servername = "localhost";
- $username = "algolhos_unisitc";
- $password = "Un1s1t_commerce";
- $dbname = "algolhos_unisitc";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT codice_target FROM customer";
- $result = $conn->query($sql);
- $rtoclass = array();
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "id: " . $row["id_customer"]. " - Codice target: " . $row["codice_target"]."<br>";
- $rtoclass[] = $row;
- }
- } else {
- echo "0 results";
- }
- $conn->close();
- return $rtoclass;
- }
- $obj->set_arr_needed( get_array_needed() ); // change $obj with the instance name writeToFile() is using...
- public function writeToFile($ae, $sorted_fields, $elements)
- {
- $url = $this->getFileUrl($ae->filename, $ae->type);
- $file = @fopen( $url, 'w' );
- //add labels for export data ==== Nascosto da Dario
- //if($ae->add_header)
- //$this->filewrite($ae, $sorted_fields, $file);
- $i = 0;
- while ($element = $this->nextRow($elements))
- {
- if ($i == $this->rowsNumber - 1)
- {
- $this->lastElement = $element;
- }
- Configuration::updateGlobalValue("AdvancedExport_CURRENT", (string)$i);
- //progress bar
- $this->getDataFromObject($element, $file, $sorted_fields, $ae);
- $i++; //progress bar
- }
- //close file
- if($file)
- fclose($file);
- return $url;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement