Php’de Mysql ile Excell Dosyası Oluşturma

Veri tabanlarımızda yer alan bilgilerin kimi zaman döküman halinde office programlarına aktarılması gerekebilir. Veri tabanımızda yer alan exmples tablosundaki verileri örneğimizde excell dökümanı olarak çıktısını alacağız. Veritabanı adımız excell, tablo adımız exmples, tablomuzda yer alan id, name, url, aciklama alanlarında yer alan verileri
gumusluoglu.xls office dosyasına aktaracagız.

index.php kodlarımız

header( "Content-Type: application/vnd.ms-excel" );

header( "Content-disposition: attachment; filename=gumusluoglu.xls" );

require_once("mysql.php");

echo 'İd' . "\t" . 'Konu Başlığı' . "\t" . 'Link' . "\t" . 'Açıklama' . "\n";

$q=$dba->query(“SELECT * FROM exmples Order by id”);

while($row=$dba->fetch_assoc($q)){

echo $row['id']. “\t” . $row['name'] . “\t” . $row['url'] .”\t” . $row['icerik'] . “\n”;

}

?>

This entry was posted on Salı, Kasım 24th, 2009 at 17:20 and is filed under PHP ve MySql. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.