ทำไมขึ้นWarning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\clinicsystem\show_serway_admin.php on line 157
มันขึ้น error คะ
Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\clinicsystem\show_serway_admin.php on line 157 แบบนี้ ไม่ทราบว่าผิดตรงไหนคะ
นี้โค๊ดคะ
Code (PHP)
<!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=windows-874" />
<title>รายงานการรักษา/จ่ายยา</title>
<script Language="Javascript">
<!--
function Conf(object) {
if (confirm("โปรดยืนยันการลบ ?") == true) {
return true;
}
return false;
}
//-->
</script>
<style type="text/css">
<!--
body {
background-color: #93EAFF;
}
.style56 { font-family: "MS Sans Serif";
font-size: 15px;
font-weight: bold;
}
.style49 {color: #FFFFFF; font-family: AngsanaUPC; font-size: 20px; }
.style60 {font-family: "MS Sans Serif"}
.style61 {font-family: "MS Sans Serif"; font-size: 15px; }
.style63 {font-size: 15px}
.style64 {font-size: 14px}
.style65 {
font-family: "Angsana New";
font-size: 22px;
}
.style76 {font-family: "MS Sans Serif"; font-size: 14px; font-weight: bold; }
.style89 {color: #000000; font-weight: bold;}
-->
</style>
</head>
<body>
<table width="955" height="501" border="1" align="center">
<tr>
<td height="26" colspan="2"><? require('header.php') ?></td>
</tr>
<tr>
<td colspan="2" bordercolor="#93EAFF" background="../image/top.jpg" bgcolor="#93EAFF">
<marquee>
<div align="center"><span class="style49">ระบบการให้บริการคลินิกหมอบุญพิมล </span></div>
</marquee></td>
</tr>
<tr>
<td width="20" valign="top" bgcolor="#FFFFFF"><a href="officer_add.php">
<? include ('menu_admin.php')?>
</a></td>
<td width="919" valign="top" bgcolor="#FFFFFF"><p align="center">
<br />
<span class="style56">รายงานการตรวจรักษาและจ่ายยา</span>
<table width="94%" align="center" cellspacing="3">
<tr background="image/top.jpg"><td><div align="center" class="style61"><span class="style36"><strong>รหัสการจ่ายยา</strong></span></div></td>
<td align="center"><span class="style56">รหัสการรักษา</span></td>
<td align="center"><span class="style36 style60 style63"><strong>วันที่จ่ายยา</strong></span></td>
<td align="center"><span class="style36 style60 style63"><strong>เวลา</strong></span></td>
<td align="center"><span class="style36 style60 style63"><strong>รหัสยา</strong></span></td>
<td align="center"><span class="style36 style60 style63"><strong>จำนวน</strong></span></td>
<td align="center"><span class="style36 style60 style63"><strong>หน่วยยา</strong></span></td>
<td align="center"><span class="style36 style60 style63"><strong>ราคา</strong></span></td>
<td align="center"><span class="style36 style60 style63"><strong>ลบ</strong></span></td>
</tr>
<?php
include("include/config.php");
$strSQL = "SELECT * FROM pay_medicine,pay_medicine_details";
mysql_query("SET NAMES tis620");
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 20; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by pay_medicine.pay_id = pay_medicine_details.pay_id ASC LIMIT $Page_Start , $Per_Page";
// คำสั่ง SQL ที่ใช้ในการเลือกข้อมูลที่อยู่ในฐานข้อมูลกลับมา (เรียงตามลำดับ ID)
$result = mysql_query("select pay_medicine.pay_id,pay_medicine.preseway_id,pay_medicine.pay_date,pay_medicine.pay_time,pay_medicine_details.pay_details_id,pay_medicine_details.store_id,pay_medicine_details.order_date,pay_medicine_details.qty,pay_medicine_details.unit_drug,pay_medicine_details.price
from pay_medicine,pay_medicine_details
WHERE pay_medicine.pay_id = pay_medicine_details.pay_id");
?>
<?
/* ในลูปด้านล่าง เทียบได้กับการดึงข้อมูลมาทีละ 1 Record เพื่อนำมาแสดงผลทางหน้าจอ */
$i = 0;
while($dbarr = mysql_fetch_array($result)) {
{
$i++;
?>
<tr bgcolor="#FFFFAA">
<td width="15%" height="26" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['pay_id'] ; ?></span></td>
<td width="13%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['preseway_id'] ; ?></span></td>
<td width="13%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['pay_date'] ; ?></span></td>
<td width="14%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['pay_time'] ; ?> น. </span></td>
<td width="10%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['store_id'] ; ?></span></td>
<td width="10%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['qty'] ; ?></span></td>
<td width="8%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['unit_drug'] ; ?></span></td>
<td width="9%" align="center" bgcolor="#dcf9ff"><span class="style47 style60 style64"><?php echo $dbarr['price'] ; ?> บาท </span></td>
<td width="8%" align="center" bgcolor="#dcf9ff"><center class="style43 style21 style48 style60 style64"><a href="delete_serway.php?pay_id=<?=$dbarr['pay_id'];?>" OnClick="return Conf(this)"><img src="image/delete.gif" width="26" height="26" border="0"></a>
</center></td>
</tr>
<?php
}
}
?>
</table>
<p align="center"><span class="style92"><span class="style24"> <span class="style89">หน้า :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ก่อนหน้า</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>ถัดไป>></a> ";
}
mysql_close($objConnect);
?>
</span></span> <span class="style76"> </span>
<form id="form1" name="form1" method="post" action="show_serway.php">
<label></label>
<div align="center">
<input type="submit" name="Submit" value="ต้องการพิมพ์" />
</div>
</form>
<br />
</p>
<div align="center">
<p><a href="indexadmin.php" class="style65">ย้อนกลับ</a><br />
<br />
</p>
</div></td>
</tr>
<tr>
<td height="26" colspan="2"><? require('footer.php') ?></td>
</tr>
</table>
</body>
</html>
Tag : PHP, MySQL
Date :
2012-04-22 10:54:27
By :
อิอิอิ
View :
1742
Reply :
3
$objConnect มีจริงหรอครับในไฟล์ config
Date :
2012-04-22 11:48:38
By :
ikikkok
mysql_close($objConnect);
มันหา...ไม่เจอละ...ม๊าง...
code connect....เขียนแบบไหน...น๊า.......
Date :
2012-04-22 11:57:06
By :
time.toon
ได้แล้วคะ ขอบคุณคะ
Date :
2012-04-22 12:13:33
By :
อิอิอิ
Load balance : Server 00