|
|
|
อยากทราบว่าเวลาเรา save ไฟล์ word แต่พอไปเปิดไม่สามรถเปิดได้ |
|
|
|
|
|
|
|
ช่วยแก้ให้หน่อยนะคร้า
Code (PHP)
<?php include "./connect.php";
if($_GET['ID']) {
$number=$_GET["ID"];
$sqlselect="select * from deposit_announcement where ID='$ID'";
$resultselect=mysql_query($sqlselect);
$row=mysql_fetch_array($resultselect);
}
if ($_POST['edit']) {
$tnews=$_POST["news"];
$tdetail=$_POST["detail"];
$tname=$_POST["name"];
$tlocation=$_POST["location"];
$temail=$_POST["email"];
$tfile=$_FILES['fileAttach']['name'];
$tstatus=$_POST["status"];
copy($_FILES['fileAttach']['tmp_name'],"./filesAttach/$tfile");
$sql="update deposit_announcement set news='$tnews',detail='$tdetail',name='$tname',location='$tlocation',email='$temail',file='$tfile',status='$tstatus' where ID='$ID'";
$result=mysql_query($sql);
if(isset($result))
{
?>
<script language="javascript">
alert("บันทึกข้อมูลเรียบร้อยแล้ว"); location.href="admindeleteusers.php";
</script>
<? } else ?>
<script language="javascript">
alert("ไม่สามารถบันทึกข้อมูลได้"); location.href="index.php";
</script>
<? } elseif ($_POST['save1']) {
$tnews=$_POST["news"];
$tdetail=$_POST["detail"];
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
</style>
</head>
<body>
<table width="889" height="45" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td width="13" height="14" background="images/index_01.gif"><img src="images/index_01.gif" width="13" height="14" /></td>
<td width="863" height="14" background="images/index_02.gif"></td>
<td width="13" height="14" background="images/index_03.gif"><img src="images/index_03.gif" width="13" height="14" /></td>
</tr>
<tr>
<td width="13" height="15" background="images/index_04.gif"></td>
<td align="center" bgcolor="#FFFFFF"><form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<p> </p>
<table width="632" height="268" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" colspan="2" align="left" bgcolor="#1C86EE"><table width="280" height="32" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="48"><img src="images/file_find.png" width="48" height="48" /></td>
<td width="232" align="center"><h3><strong>ดูข้อมูลข่าวฝากประกาศ</strong></h3></td>
</tr>
</table></td>
</tr>
<tr>
<td width="134" align="left" bgcolor="#CAE1FF"><strong>หัวข้อข่าว</strong></td>
<td width="498" align="left" bgcolor="#CAE1FF"><label for="news3"></label>
<input name="news" type="text" id="news3" value="<?=$row["news"];?>" />
<em>
<input name="ID" type="hidden" id="ID" value="<?=$row["ID"];?>" />
</em></td>
</tr>
<tr>
<td align="left" bgcolor="#CAE1FF"><strong>รายละเอียดข่าว</strong></td>
<td align="left" bgcolor="#CAE1FF"><label for="location3">
<textarea name="detail" id="detail" cols="45" rows="5"><?=$row["detail"];?>
</textarea>
</label></td>
</tr>
<tr>
<td align="left" bgcolor="#CAE1FF"><strong>ชื่อผู้ฝาก</strong></td>
<td align="left" bgcolor="#CAE1FF"><label for="detail">
<input name="name" type="text" id="name" value="<?=$row["name"];?>" />
</label></td>
</tr>
<tr>
<td align="left" bgcolor="#CAE1FF"><strong>สถานที่</strong></td>
<td align="left" bgcolor="#CAE1FF"><label for="textfield3"></label>
<input name="location" type="text" id="textfield3" value="<?=$row["location"];?>" />
<label for="name"></label></td>
</tr>
<tr>
<td align="left" bgcolor="#CAE1FF"><strong>E-mail</strong></td>
<td align="left" bgcolor="#CAE1FF"><input name="email" type="text" id="email3" value="<?=$row["email"];?>" /></td>
</tr>
<tr>
<td align="left" bgcolor="#CAE1FF"><strong>แก้ไขไฟล์</strong></td>
<td align="left" bgcolor="#CAE1FF"><label for="fileAttach"></label>
<input type="file" name="fileAttach" id="fileAttach" /></td>
</tr>
<tr>
<td align="left" bgcolor="#CAE1FF"> </td>
<td align="left" bgcolor="#CAE1FF"><input name="status" type="checkbox" id="status" value="1" />
<label for="email2">สถานะการแสดงผล</label></td>
</tr>
<tr>
<td height="24" colspan="2" align="center" bgcolor="#CAE1FF"><input type="submit" name="edit" id="edit" value="บันทึกข้อมูลเพิ่มเติม" />
<?
$ii=$row["file"];
$arr = explode(".",$ii);
$check=$arr[count($arr)-1];
$news=".".$check;
if ($news==".docx" or $news==".doc" or $news==".txt") {
?>
<a href="openpicter.php?id=<?=$ii?>">แสดงไฟล์ที่แนบมา
<?
} else { ?></a><a href="filesAttach/<?=$ii?>">แสดงไฟล์ที่แนบม
<?
}
?>
</a></td>
</tr>
<tr>
<td height="24" colspan="2" align="left" bgcolor="#CAE1FF"> </td>
</tr>
</table>
<p><a href="admin_index(2).php"><<กลับไปหน้าที่ยังไม่ได้โพสต์>
></a><a href="admindeleteusers.php"><<กลับไปหน้าที่้โพสต์แล้ว>
></a></p>
</form></td>
<td width="13" height="15" background="images/index_06.gif"></td>
</tr>
<tr>
<td width="13" height="14" background="images/index_07.gif"></td>
<td background="images/index_08.gif"></td>
<td width="13" height="14" background="images/index_09.gif"></td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2011-05-09 15:55:33 |
By :
mintmicky |
View :
814 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment; filename=testing.doc");
?>
<html>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["CustomerID"];?></div></td>
<td><?=$objResult["Name"];?></td>
<td><?=$objResult["Email"];?></td>
<td><div align="center"><?=$objResult["CountryCode"];?></div></td>
<td align="right"><?=$objResult["Budget"];?></td>
<td align="right"><?=$objResult["Used"];?></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
?>
</body>
</html>
Go to : PHP Word header("Content-type: application/vnd.ms-word");
|
|
|
|
|
Date :
2011-05-09 17:30:43 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|