8795 sujets

Développement web côté serveur, CMS

Bonjour je cherche a convertir un fichier php en fichier excel , cela marche tres bien car mon fichier excel m'affiche un résultat , seulement je veux pouvoir afficher tous les résultats de ma table comment faire merci de votre aide
<?php require_once "../Connections/bookpro.php";

mysql_select_db($database_bookpro, $bookpro);
$query_me = "SELECT * FROM visiteurs";
$me = mysql_query($query_me, $bookpro) or die(mysql_error());
$row_me = mysql_fetch_assoc($me);


set_time_limit(10);
require_once "writeexcel/class.writeexcel_workbook.inc.php";
require_once "writeexcel/class.writeexcel_worksheet.inc.php";



$fname = tempnam("/tmp", "stocks.xls");
$workbook = &new writeexcel_workbook($fname);
$worksheet =& $workbook->addworksheet();

# Set the column width for columns 1, 2, 3 and 4
$worksheet->set_column(0, 3, 15);

# Create a format for the column headings
$header =& $workbook->addformat();
$header->set_bold();
$header->set_size(12);
$header->set_color('blue');

# Create a format for the stock price
$f_price =& $workbook->addformat();
$f_price->set_align('left');
$f_price->set_num_format('00:00');

# Create a format for the stock volume
$f_volume =& $workbook->addformat();
$f_volume->set_align('left');
$f_volume->set_num_format('#,##0');

# Create a format for the price change. This is an example of a conditional
# format. The number is formatted as a percentage. If it is positive it is
# formatted in green, if it is negative it is formatted in red and if it is
# zero it is formatted as the default font colour (in this case black).
# Note: the [Green] format produces an unappealing lime green. Try
# [Color 10] instead for a dark green.
#
$f_change =& $workbook->addformat();
$f_change->set_align('left');
$f_change->set_num_format('[Green]0.0%;[Red]-0.0%;0.0%');

# Write out the data
$worksheet->write(0, 0, 'Bookpro', $header);
$worksheet->write(0, 1, 'Date',   $header);
$worksheet->write(0, 2, 'Heure arrivée',  $header);
$worksheet->write(0, 3, 'Heure départ',  $header);

$worksheet->write(1, 1, $row_me['date'],     $f_price);  # $30.25
$worksheet->write(1, 2, $row_me['Heurearrivee'],   $f_volume); # 1,234,567
$worksheet->write(1, 3,$row_me['heuredepart'],     $f_change); # 8.5% in green


$workbook->close();

header("Content-Type: application/x-msexcel; name=\"example-stocks.xls\"");
header("Content-Disposition: inline; filename=\"example-stocks.xls\"");
$fh=fopen($fname, "rb");
fpassthru($fh);
unlink($fname);

?>
Smiley fache
Peux-tu nous dire ce que ça te donne actuellement et ce que tu veux avoir en plus ?

Sinon, personne ne pourra t'aider.
Smiley cligne