Need data from the database in MS Excel.

Algorithm:

<? php> define("HOST", "localhost"); define("USER", "пользователь"); define("PASSWORD", "пароль"); define("", ""); $db = mysql_connect (HOST, USER, PASSWORD); if (!$db) { exit ('wrong connection'); } if(!mysql_select_db)('бд', $пользователь)) { exit(DB) ; } mysql_querry ('SET NAMES utf8'); ?> 

functions.php

 <?php function get price() { $sql = "SELECT title, price, quantity, description FROM название_табл"; $result = mysql_query ($sql); if (!result) { exit(mysql_error()); } $row = array (); for($i = 0; $i < mysl_num_rows ($result);$i++) { row[] = mysql_fetch_assoc($result); } return $row; } 

do I need to upload other files from classes to phpexcel.php ?

price or index file:

 <?php /** PHPExcel */ require_once 'config.php'; require_once 'functions.php'; require_once 'Classes/PHPExcel.php'; $price_list = get_price (); print_r ($price_list); 

file when refreshing the page does not load xsl with tables. Tell me something!

  • And why should he upload them? - u_mulder
  • need data from the database in excel. Settings + two files so that the xsl file is downloaded "download" + phpexcel. - ViachesKr
  • I did not ask what you need. I asked why you think your code will load something? In files with PHPExcel there is an examples folder, look at the examples of work in it and do the same. - u_mulder
  • I do not state, but ask. Listing '<? Php / ** PHPExcel * / ... shown without design - ViachesKr
  • I do not state, but ask. Listing '<? Php / ** PHPExcel * / ... is a fragment of code when uploading, the file is loaded - the data from the database to Excel. The example is not what I need - ViachesKr

0