<? header("Content-Type: application/msexcel"); header('Content-Disposition: attachment; filename="Report.xls"'); //จะให้มันแสดงแทนที่ Report ยังไงครับ ?> <html> <head> <title>Customer</title> </head> <body background="bg-1.jpg"><center> <?php $objConnect = mysql_connect("localhost","root","03112530") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); mysql_query("SET character_set_results=utf8"); mysql_query("SET character_set_client=utf8"); mysql_query("SET character_set_connection=utf8"); $strSQL="SELECT * FROM customer2 "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $num_rows = mysql_num_rows($objQuery); ?> <br/> <br/> <table border="1" width="900" cellpadding='0' cellspacing='0'> <tr> <th width="61">AID</th> <th width="207">ANAME</th> <th width="100">ASEX</th> <th width="100">ABILITY</th> <th width="129">AEMAIL</th> <th width="103">ACOUNTRY</th> <th width="96">ABUDGET</th> </tr> <?php $i=0; while($i < $num_rows) { $result = mysql_fetch_array($objQuery); $i1=$result[AID]; $i2=$result[ANAME]; $i3=$result[ASEX]; $i4=$result[ABILITY]; $i5=$result[AEMAIL]; $i6=$result[ACOUNTRY]; $i7=$result[ABUDGET]; echo "<tr>" . "<td align='center'>" . $i1. "</td>" . "<td align='center'>" . $i2 . "</td>" . "<td align='center'>" . $i3 . "</td>" . "<td align='center'>" . $i4 . "</td>" . "<td align='center'>" . $i5 . "</td>" . "<td align='center'>" . $i6 . "</td>" . "<td align='center'>" . $i7 . "</td>" . "</tr>"; $i++; } mysql_close(); ?> </table> </body> </html>
<?php $content = ' <html> <head> <title>Customer</title> </head> <body background="bg-1.jpg"><center> <br/> <br/> <table border="1" width="900" cellpadding="0" cellspacing="0"> <tr> <th width="61">AID</th> <th width="207">ANAME</th> <th width="100">ASEX</th> <th width="100">ABILITY</th> <th width="129">AEMAIL</th> <th width="103">ACOUNTRY</th> <th width="96">ABUDGET</th> </tr> </table> </body> </html> '; $aname = 'ANAME'; header("Content-Type: application/msexcel"); header('Content-Disposition: attachment; filename="'.$aname.'.xls"'); echo $content; ?>
<?php $mysqli = mysqli_connect("localhost","root","03112530") or die("Error Connect to Database".$mysqli->connect_error);); $mysqli->select_db("mydatabase"); $mysqli->set_charset("utf8"); $strSQL="SELECT * FROM `customer2` "; $objQuery = $mysqli->query($strSQL); foreach ($objQuery as $value) { $filename = $value["ANAME"]; } header("Content-Type: application/msexcel"); header('Content-Disposition: attachment; filename="'.$filename.'"'); //จะให้มันแสดงแทนที่ Report ยังไงครับ ?> <html> <head> <title>Customer</title> </head> <body background="bg-1.jpg"><center> <br/> <br/> <table border="1" width="900" cellpadding='0' cellspacing='0'> <tr> <th width="61">AID</th> <th width="207">ANAME</th> <th width="100">ASEX</th> <th width="100">ABILITY</th> <th width="129">AEMAIL</th> <th width="103">ACOUNTRY</th> <th width="96">ABUDGET</th> </tr> <?php foreach ($objQuery as $value) { echo "<tr>" . "<td align='center'>" . $value["AID"]. "</td>" . "<td align='center'>" . $value["ANAME"] . "</td>" . "<td align='center'>" . $value["ASEX"] . "</td>" . "<td align='center'>" . $value["ABILITY"] . "</td>" . "<td align='center'>" . $value["AEMAIL"] . "</td>" . "<td align='center'>" . $value["ACOUNTRY"] . "</td>" . "<td align='center'>" . $value["ABUDGET"] . "</td>" . "</tr>"; } $mysqli->close(); ?> </table> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง