skip to main
|
skip to sidebar
Pages
Home
friendLinks
linkExchanges
parseHTML
Loading...
☺ indahnyaBerbagi ☺
Script PHP untuk meng-export query MySQL ke Excel
Langsung aja ya gan..! Ni scripnya:
<form id=”form1″ name=”form1″ method=”post” action=”excel.php”> <p> QUERY : <br /> <textarea name=”sql” cols=”50″ rows=”6″ id=”sql”></textarea> </p> <p> <input type=”submit” name=”Submit” value=”Submit” /> </p> </form> <p style=”text-align: justify;”><strong>Nama File : excel.php</strong> <?php $hostname = “localhost”; $username = “root”; $database = “a”; $password = “”; $conn = mysql_connect($hostname,$username,$password); mysql_select_db($database); if (isset($_POST['sql'])) { $q = mysql_query(stripslashes($_POST['sql'])) or die (“Not valid query !”); $res = “”; while ($f = mysql_fetch_field($q)) { $res .= $f->name . “\t”; } $res .= “\r\n”; while ($r = mysql_fetch_array($q)) { for ($i=0; $i<mysql_num_fields($q); $i++) { $res .= $r[$i] . “\t”; } $res .= “\r\n”; } mysql_free_result($q); header(“Content-disposition: attachment; filename=aan.xls”); header(“Content-type: Application/exe”); header(“Content-Transfer-Encoding: binary”); echo $res; } ?>
Sekian, semoga bermanfaat##
Selamat mencoba...
No comments:
Post a Comment
what are you comments?
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Open Cbox
Updates Via E-Mail
Facebook
Twitter
RSS
Blog Archives
►
2013
(1)
►
March
(1)
▼
2012
(57)
►
October
(1)
▼
September
(10)
Meng-install apache tomcat 6.0 pada windows XP
Dasar Java Server Pages (JSP)
Membuat loading dengan borland delphi
Slideshow otomatis dengan item navigasi angka meng...
Membuat kotak melayang dengan CSS
Cara membuat popUp
Script PHP untuk meng-export query MySQL ke Excel
Cara mempercepat booting windows xp dan windows 7
Cheats GTA-san-andreas
Kaleng bekas dapat memperkuat sinyal WIFI
►
August
(2)
►
June
(1)
►
May
(1)
►
April
(1)
►
March
(4)
►
February
(21)
►
January
(16)
►
2011
(116)
►
December
(8)
►
November
(3)
►
September
(17)
►
August
(19)
►
July
(46)
►
June
(11)
►
May
(4)
►
March
(2)
►
January
(6)
►
2010
(22)
►
November
(4)
►
October
(2)
►
September
(2)
►
August
(13)
►
May
(1)
follow
on fb
statistik
No comments:
Post a Comment
what are you comments?