|
|
|
ทำไมมันค้นหาม่เจอคะ เป็นเพราะอะไร ไม่แสดงerror แล้ว รบกวนด้วยคะ |
|
|
|
|
|
|
|
ค้นหาไม่เจอคะ ไม่มี error อะรคะ
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;
}
//-->
function autoTab2(obj){
var pattern=new String("__-__-____"); // กำหนดรูปแบบในนี้
var pattern_ex=new String("-"); // กำหนดสัญลักษณ์หรือเครื่องหมายที่ใช้แบ่งในนี้
var returnText=new String("");
var obj_l=obj.value.length;
var obj_l2=obj_l-1;
for(i=0;i<pattern.length;i++){
if(obj_l2==i && pattern.charAt(i+1)==pattern_ex){
returnText+=obj.value+pattern_ex;
obj.value=returnText;
}
}
if(obj_l>=pattern.length){
obj.value=obj.value.substr(0,pattern.length);
}
}
</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;}
.style4 { font-family: "Angsana New";
font-size: 20px;
}
-->
</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>
<form id="post_form" name="post_form" method="post" action="">
<table width="100%" align="center">
<tr>
<td width="41%"><div align="right" class="style4"><strong> วัน/เดือน/ปี </strong></div></td>
<td width="59%"><label>
<input name="pay_date" type="text" id="pay_date" onkeyup="autoTab2(this)" onkeypress="check_number();">
</label>
<input type="submit" name="button" id="button" value="ค้นหารายงาน" />
<input name="hid" type="hidden" id="hid" value="search" /></td>
</tr>
</table>
<p align="center">
</p></form>
<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");
if ($_POST[hid ]=='search'){
$pay_date= $_POST[pay_date];
$strSQL = "SELECT * FROM pay_medicine,pay_medicine_details where pay_date = '$pay_date'";
mysql_query("SET NAMES tis620");
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 15; // 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";
$objQuery = mysql_query($strSQL);
// คำสั่ง 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($objQuery)) {
{
$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($connect);
?>
</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 13:10:02 |
By :
44 |
View :
900 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$objQuery = mysql_query($strSQL) or die(mysql_error());
จะได้รู้ว่า error เพระาอะไร
|
|
|
|
|
Date :
2012-04-22 13:12:54 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|