Extraire d'une bdd MySQL au format XLS et PDF
nouabi
Messages postés
147
Statut
Membre
-
nouabi Messages postés 147 Statut Membre -
nouabi Messages postés 147 Statut Membre -
Bonjour,
Sur une page web (php), je souhaite créer un bouton permettant d'extraire de ma base de donnée MySQL le contenu d'un champs au format XLS et, pour un autre bouton, au format PDF.
Comment faire ?
Merci pour votre aide !
Sur une page web (php), je souhaite créer un bouton permettant d'extraire de ma base de donnée MySQL le contenu d'un champs au format XLS et, pour un autre bouton, au format PDF.
Comment faire ?
Merci pour votre aide !
A voir également:
- Extraire d'une bdd MySQL au format XLS et PDF
- Lire le coran en français pdf - Télécharger - Histoire & Religion
- Format epub - Guide
- Format factory - Télécharger - Conversion & Codecs
- Extraire une video youtube - Guide
- Extraire le son d'une vidéo - Guide
2 réponses
<?php
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\"?>\n";
echo "<exemple>\n";
//on connecte a la BDD
$dbhost="localhost";
$dbuser="gael";
$dbpass="donat ";
$dblink=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("gael",$dblink);
//on lance la requete
$query = "SELECT * FROM temp";
$result = mysql_query($query,$dblink) or die (mysql_error($dblink));
//On boucle sur le resultat
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
echo "<donnee>" . $row[0] . "</donnee>\n";
}
echo "</exemple>\n";
?>
ça c'est pour le XML, et pour le PDF il faut utiliser la librairie FPDF par exemple :
http://www.fpdf.org/
header('Content-Type: text/xml');
echo "<?xml version=\"1.0\"?>\n";
echo "<exemple>\n";
//on connecte a la BDD
$dbhost="localhost";
$dbuser="gael";
$dbpass="donat ";
$dblink=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db("gael",$dblink);
//on lance la requete
$query = "SELECT * FROM temp";
$result = mysql_query($query,$dblink) or die (mysql_error($dblink));
//On boucle sur le resultat
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
echo "<donnee>" . $row[0] . "</donnee>\n";
}
echo "</exemple>\n";
?>
ça c'est pour le XML, et pour le PDF il faut utiliser la librairie FPDF par exemple :
http://www.fpdf.org/
bonjour,
Je ne voi pas comment je peu l'insérer dans mon code (probleme avec header !)
help me please !!! merci d'avance
Je ne voi pas comment je peu l'insérer dans mon code (probleme avec header !)
<?php
include("FCKeditor/fckeditor.php") ;
$hote = "localhost";
$utilisateur = "root";
$mPasse = "";
$base = "test";
$connexion = mysql_connect($hote, $utilisateur, $mPasse) or die ("connexion au serveur impossible");
$db = mysql_select_db($base, $connexion) or die ("impossible d'ouvrir la base de données");
if ((isset($_POST['txt1'])) && (isset($_POST['txt2'])))
{
$data1 = mysql_real_escape_string(trim($_POST['txt1']));
$data2 = mysql_real_escape_string(trim($_POST['txt2']));
$res1 = mysql_query("UPDATE textes SET text = '".$data1."' WHERE num_text = 1");
$res2 = mysql_query("UPDATE textes2 SET text = '".$data2."' WHERE num_text = 1");
if (!$res1)
die("Erreur de sauvegarde!".mysql_error());
if (!$res2)
die("Erreur de sauvegarde!".mysql_error());
}
?>
<html>
<head>
<title>cadre_milieu</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
.Style2 {font-weight: bold; font-size: 36px; font-family: "Comic Sans MS"; color:#000066}
.Style5 {font-size: 12px}
-->
</style>
</head>
<body>
<h1 align="center" class="Style2"><img src="fantastique.jpg" width="956" height="200"></h1>
<center>
<form action="index2.php" method="post">
<?php
$query = mysql_query("SELECT text FROM textes WHERE num_text = 1");
$data1 = mysql_fetch_array($query);
$oFCKeditor = new FCKeditor('txt1') ;
$oFCKeditor->BasePath = '/FCKeditor/';
$oFCKeditor->Width = '60%' ;
$oFCKeditor->Height = '200' ;
$oFCKeditor->Value = $data1["text"];
$oFCKeditor->Create() ;
$oFCKeditor->Config['CustomConfigurationsPath'] = '/fckconfig.js' ;
?>
</form>
<br>
<form action"index2.php" method="post">
<input name="submit" type="submit" value="Exporter au format XLS">
<input type="submit" value="Exporter au format PDF">
</form>
<br>
<form action="index2.php" method="post">
<?php
$query = mysql_query("SELECT text FROM textes2 WHERE num_text = 1");
$data2 = mysql_fetch_array($query);
$oFCKeditor = new FCKeditor('txt2') ;
$oFCKeditor->BasePath = '/FCKeditor/' ;
$oFCKeditor->Width = '60%' ;
$oFCKeditor->Height = '200' ;
$oFCKeditor->Value = $data2["text"];
$oFCKeditor->Create() ;
$oFCKeditor->Config['CustomConfigurationsPath'] = '/fckconfig.js' ;
?>
</form>
<br>
<form action"index2.php" method="post">
<input name="submit" type="submit" value="Exporter au format XLS">
<input type="submit" value="Exporter au format PDF">
</form>
<br>
</center>
</body>
</html>
<?php
mysql_close($connexion);
?>
help me please !!! merci d'avance