Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ผมต้องการออกรายงาน เป็น html และ excel พอ submit ไป ขึ้น error ครับ ช่่วยหน่อยครับ Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in



 

ผมต้องการออกรายงาน เป็น html และ excel พอ submit ไป ขึ้น error ครับ ช่่วยหน่อยครับ Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in

 



Topic : 079615

Guest




ภาพขึ้น error

รูปตารางที่ query

secur_data

code form
Code (PHP)
<html>
<head>
<script language='javascript' src='popcalendar.js'></script>
<title><? include "config.php";echo "$title";?></title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-874">
<style type="text/css">
<!--
.bb12 {font-size: 12px;
	font-family: "ms Sans Serif";
}
.white14bold {font-size: 14px; font-family: "ms Sans Serif"; font-weight: bold; color: #FFFFFF; }
.black14b {
	font-size: 14px;
	font-weight: bold;
}
.style2 {font-family: "ms Sans Serif"}
.bob12 {font-size: 12px; font-family: "ms Sans Serif"; font-weight: bold; }
.bolwi12 {font-size: 12px; font-family: "ms Sans Serif"; font-weight: bold; color: #FFFFFF; }
.unnamed1 {	font-family: "MS Sans Serif", Tahoma, sans-serif;
	font-size: 14px;
}
-->
</style>
<link href="fileinclude/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (securi2_resize.jpg) -->
<table width="968" height="801" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
	<tr>
		<td colspan="2" rowspan="6">
			<img src="images/index_01.jpg" width="30" height="248" alt=""></td>
		<td>
			<img src="images/index_02.jpg" width="184" height="73" alt=""></td>
		<td colspan="2" rowspan="6">
			<img src="images/index_03.jpg" width="754" height="248" alt=""></td>
	</tr>
	<tr>
		<td>
			<a href="add_data.php"><img src="images/index_04.jpg" alt="" width="184" height="32" border="0"></a></td>
	</tr>
	<tr>
		<td>
			<a href="show_data.php"><img src="images/index_05.jpg" alt="" width="184" height="34" border="0"></a></td>
	</tr>
	<tr>
		<td>
			<img src="images/index_06.jpg" width="184" height="35" alt=""></td>
	</tr>
	<tr>
		<td>
			<a href="logout.php"><img src="images/index_07.jpg" alt="" width="184" height="32" border="0"></a></td>
	</tr>
	<tr>
		<td>
			<img src="images/index_08.jpg" width="184" height="42" alt=""></td>
	</tr>
	<tr>
		<td background="images/index_09.jpg" bgcolor="#41A72A"><img src="images/index_09.jpg" width="6" height="486"></td>
        <td colspan="3" valign="top"><form name="form1" method="post" action="">
          <table width="500" border="0" align="center" cellpadding="2" cellspacing="2">
            <tr>
              <td width="314"><table width="500" border="0">
                  <tr bgcolor="#BDDCEC" class="unnamed1">
                    <td height="22" bgcolor="#00CC99"><div align="center">ระบุ เดือน และ พ.ศ. ที่ต้องการออกรายงาน </div></td>
                  </tr>
                  <tr class="unnamed1">
                    <?
		$today = date('d/m/Y');
		 list($day, $month, $year) = split('[/.-]', $today);
		$year = $year + 543;
		$today=  "$day/$month/$year"; ?>
                    <td><div align="center">ตั้งแต่ วันที่ :
                      <input name="daymonthyear1" type=text id="daymonthyear1" onKeyPress="kod_pum()" size="12" value="<? echo "$today"; ?>">
                        <script language='javascript'>
  
  if (!document.layers) {
     document.write("<input type=button onclick='popUpCalendar(this,\"daymonthyear1\", \"dd/mm/yyyy\")' value=' Date ' style='font-size:11px'>")
   }


                        </script>
&nbsp;&nbsp;ถึงวันที่ :
<input name="daymonthyear2" type=text id="daymonthyear2" onKeyPress="kod_pum()" size="12" value="<? echo "$today"; ?>">
                      <script language='javascript'>
  
  if (!document.layers) {
     document.write("<input type=button onclick='popUpCalendar(this,\"daymonthyear2\", \"dd/mm/yyyy\")' value=' Date ' style='font-size:11px'>")
   }


                      </script>
                    </div></td>
                  </tr>

              </table></td>
            </tr>
            <tr>
              <td><table width="500" border="0">
                  <tr bgcolor="#BDDCEC" class="unnamed1">
                    <td height="20" bgcolor="#00CC99"><div align="center">เลือกรูปแบบการออกรายงาน</div></td>
                  </tr>
                  <tr bgcolor="#BDDCEC" class="unnamed1">
                    <td bgcolor="#F4F4F4"><div align="center">
                      <select name="sel_exportType" class="ListBox">
                        <option value="HTML" selected>HTML</option>
                        <option value="XLS">Excel</option>
                      </select>
                      <input type="button" name="Button" value=" ตกลง " onClick="reportmonth()">
                      <label>
                      <input name="Reset" type="reset" id="Submit" value=" ยกเลิก ">
                      </label>
                    </div></td>
                  </tr>
              </table></td>
            </tr>
          </table>
                </form>
      <br></td>
        <td bgcolor="#41A72A"></td>
	</tr>
	  
	<tr>
		<td colspan="5">
			<img src="images/index_12.jpg" width="968" height="66" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="images/spacer.gif" width="6" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="24" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="184" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="750" height="1" alt=""></td>
		<td>
			<img src="images/spacer.gif" width="4" height="1" alt=""></td>
	</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>
<script language="javascript">
<!--//

function check_number() {
e_k=event.keyCode
if (((e_k < 48) || (e_k > 47)) && e_k != 46 && e_k != 13) {
//if (e_k != 13 && (e_k < 48) || (e_k > 57) || e_k == ) {
event.returnValue = false;
alert(" กรุณาใส่วันที่ โดยการกดปุ่ม DATE");
}
} 

function reportmonth(){



 exporttype = document.form1.sel_exportType.value;
$URL="savereportlevel_secur.php?daymonthyear1="+document.forms[0].daymonthyear1.value+"&exp="+exporttype+"&daymonthyear2="+document.forms[0].daymonthyear2.value;
window.open($URL,'','toolbar=no,location=no,status=no,resizable=yes,menubar=no,scrollbars=yes');

}//of function

function kod_pum() {
alert('การใส่วันที่ต้องทำการกดปุ่ม Date เท่านั้นครับ');
		event.returnValue = false;
} 
</script>






code reportlevel_secur.php
Code (PHP)
<?
  function HeaderingExcel($filename) {
	  header("Content-type: application/vnd.ms-excel");
	  header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	  header("Content-Disposition: attachment; filename=$filename" ); 
	  header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
	  header("Pragma: public");
}
  function HeaderingPDF($filename) {
	  header("Content-type: application/pdf");
	  header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	  header("Content-Disposition: attachment; filename=$filename" ); 
}
error_reporting(E_ALL ^ E_NOTICE);
if ($exp == "XLS") {
   HeaderingExcel("reportmonth.xls");
}
if ($exp == "PDF") {
   HeaderingPDF("reportmonth.pdf");
}
?>
 <?php $monthname=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");?>
      <? 		$day =array("วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัส","วันศุกร์","วันเสาร์","วันอาทิตย์");		?>
<?
list($day1, $month1, $year1) = split('[/.-]', $daymonthyear1);
		$year1 = $year1 - 543;
		$daymonthyear1=  "$year1-$month1-$day1";

list($day2, $month2, $year2) = split('[/.-]', $daymonthyear2);
		$year2 = $year2 - 543;
		$daymonthyear2=  "$year2-$month2-$day2";
?>
<?php
		
include 'config.php';
?>
<HTML>
<HEAD>
<TITLE>reportgroup</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<?
if ($exp == "HTML") {
echo "<LINK REL='StyleSheet' HREF='../../html/css/style.css' TYPE='text/css'>";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
.unnamed1 {
	font-family: "Tahoma", Tahoma, sans-serif;
	font-size: 12px;
}
.style1 {color: #0000FF}
-->
</style>
<link href="fileinclude/stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-family: "ms Sans Serif"}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY topmargin="0" >
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>  </tr>
</table>
       <?
                    $yearsql = $sel1_year - 543;
					//echo"$yearsql";
?>
<div align="center" class="unnamed1"> 
  <span class="style2">
  <? if ($month1== '1') { $showmonth1 = 'มกราคม' ;} 
   if ($month1== '2') { $showmonth1 = 'กุมภาพันธ์' ;} 
   if ($month1== '3') { $showmonth1 = 'มีนาคม' ;} 
   if ($month1== '4') { $showmonth1 = 'เมษายน' ;} 
   if ($month1== '5') { $showmonth1 = 'พฤษภาคม' ;} 
   if ($month1== '6') { $showmonth1 = 'มิถุนายน' ;} 
   if ($month1== '7') { $showmonth1 = 'กรกฏาคม' ;} 
   if ($month1== '8') { $showmonth1 = 'สิงหาคม' ;} 
   if ($month1== '9') { $showmonth1 = 'กันยายน' ;} 
   if ($month1== '10') { $showmonth1 = 'ตุลาคม' ;} 
   if ($month1== '11') { $showmonth1 = 'พฤศจิกายน' ;} 
   if ($month1== '12') { $showmonth1 = 'ธันวาคม' ;} 
   
	 if ($month2== '1') { $showmonth2 = 'มกราคม' ;} 
   if ($month2== '2') { $showmonth2 = 'กุมภาพันธ์' ;} 
   if ($month2== '3') { $showmonth2 = 'มีนาคม' ;} 
   if ($month2== '4') { $showmonth2 = 'เมษายน' ;} 
   if ($month2== '5') { $showmonth2 = 'พฤษภาคม' ;} 
   if ($month2== '6') { $showmonth2 = 'มิถุนายน' ;} 
   if ($month2== '7') { $showmonth2 = 'กรกฏาคม' ;} 
   if ($month2== '8') { $showmonth2 = 'สิงหาคม' ;} 
   if ($month2== '9') { $showmonth2 = 'กันยายน' ;} 
   if ($month2== '10') { $showmonth2 = 'ตุลาคม' ;} 
   if ($month2== '11') { $showmonth2 = 'พฤศจิกายน' ;} 
    if ($month2== '12') { $showmonth2 = 'ธันวาคม' ;} 
	$showyear1 = $year1+543;
	$showyear2 = $year2+543;
	?>
  </span>
  <p class="unnamed1"><span class="style2"><strong> <br>
    รายงานวิศวกรรมความปลอดภัยและสภาพแวดล้อมในโรงพยาบาล<br>
    ระหว่างวันที่ &nbsp;&nbsp; <? echo "$day1 $showmonth1 $showyear1" ?> &nbsp;&nbsp;&nbsp; ถึงวันที่ <strong><? echo "$day2 $showmonth2 $showyear2" ?></strong></strong></span><br>
    <br>
  <strong><br>
</strong>  </p>
  <table width="650" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF">
    <tr bgcolor="#FFA4FF" class="unnamed1">
      <td height="18" bgcolor="#00CC99"><div align="center" class="style2">ระดับความไม่ปลอดภัย</div></td>
      <td bgcolor="#00CC99"><div align="center" class="style2">จำนวนครั้งที่พบความเสี่ยง</div></td>
    <tr bgcolor="" class="unnamed1">
	<?
		include "config.php";
		//$sql="select count(s1) ,secur_name FROM secur_data WHERE date BETWEEN '$daymonthyear1' AND '$daymonthyear2' group by secur_name";
		$sql="select secur_name ,count (s1) FROM secur_data WHERE date BETWEEN '$daymonthyear1' AND '$daymonthyear2' group by secur_name";
		$result = mysql_query($dbname, $sql) or die(mysql_error());
		while ($fet = mysql_fetch_array($result))
		{
	?>
      <td><?php echo $fet['s1 ']; ?></td>
      <td ><?php echo $fet['secur_name ']; ?></td>
<?
}
?>
    <tr class="unnamed1">
  </table>
  <br>
  <br>
  <br>
  <table width="650" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <?php $monthname=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");?>
      <? 		$day =array("วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัส","วันศุกร์","วันเสาร์","วันอาทิตย์");		?>
      <td class="unnamed1"><div align="right">วันที่ออกรายงาน : <? echo $day[date('w')-1]." ".date('d')." ". $monthname[date('n')-1]." ".(date('Y')+543)." เวลา ".date('H:i:s');?></div></td>
    </tr>
  </table>
</div>
</BODY>
</HTML>


code config
Code (PHP)
<?
$link = mysql_connect("localhost", "root", "root");
mysql_query("SET NAMES TIS620");
mysql_query("USE security");
$dbserver="localhost";
$dbuser="root";
$dbpass="root";
$dbname="security";
$tbldata="secur_data";
$tbldanger="danger_level";
$tblsecur="secur_level";
$tblhos="hos_name";
$tblprov="province";
$tblmem="secur_member";
$title="โปรแกรมบันทึกความเสี่ยงในโรงพยาบาล";
$setfont="mysql_query(SET NAMES TIS620)";
$perpage=10;
$monthname=array('มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม');
$directory ="C:/AppServ/www/jp/upload/"; 	//ชื่อ directory ที่เก็บภาพ
?>




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-06-10 15:57:19 By : มือใหม่ View : 1087 Reply : 14
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Quote:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in


จาก Error เหมือนมีปัญหาเกี่ยวกับ Connection ครับ ให้ตรวจสอบ mysql_connect() ด้วยครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-10 19:24:42 By : mr.win
 


 

No. 2

Guest


ยังไม่ได้ครับ ช่วยดูหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-11 09:54:05 By : มือใหม่
 

 

No. 3



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Quote:
$link = mysql_connect("localhost", "root", "root");


แก้เป็น

Code (PHP)
$link = mysql_connect("localhost", "root", "root") or die(mysql_error());

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-11 10:23:54 By : mr.win
 


 

No. 4

Guest


error ไม่ขึ้นแล้ว แต่ query ข้อมูลไม่ออกครับ

Code (PHP)
<?
  function HeaderingExcel($filename) {
	  header("Content-type: application/vnd.ms-excel");
	  header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	  header("Content-Disposition: attachment; filename=$filename" ); 
	  header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
	  header("Pragma: public");
}
  function HeaderingPDF($filename) {
	  header("Content-type: application/pdf");
	  header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	  header("Content-Disposition: attachment; filename=$filename" ); 
}
error_reporting(E_ALL ^ E_NOTICE);
if ($exp == "XLS") {
   HeaderingExcel("reportmonth.xls");
}
if ($exp == "PDF") {
   HeaderingPDF("reportmonth.pdf");
}
?>
 <?php $monthname=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");?>
      <? 		$day =array("วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัส","วันศุกร์","วันเสาร์","วันอาทิตย์");		?>
<?
list($day1, $month1, $year1) = split('[/.-]', $daymonthyear1);
		$year1 = $year1 - 543;
		$daymonthyear1=  "$year1-$month1-$day1";

list($day2, $month2, $year2) = split('[/.-]', $daymonthyear2);
		$year2 = $year2 - 543;
		$daymonthyear2=  "$year2-$month2-$day2";
?>
<?php
		
//include "config.php";
?>
<HTML>
<HEAD>
<TITLE>reportgroup</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<?
if ($exp == "HTML") {
echo "<LINK REL='StyleSheet' HREF='../../html/css/style.css' TYPE='text/css'>";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
.unnamed1 {
	font-family: "Tahoma", Tahoma, sans-serif;
	font-size: 12px;
}
.style1 {color: #0000FF}
-->
</style>
<link href="fileinclude/stylesheet.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-family: "ms Sans Serif"}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY topmargin="0" >
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>  </tr>
</table>
       <?
                    $yearsql = $sel1_year - 543;
					//echo"$yearsql";
?>
<div align="center" class="unnamed1"> 
  <span class="style2">
  <? if ($month1== '1') { $showmonth1 = 'มกราคม' ;} 
   if ($month1== '2') { $showmonth1 = 'กุมภาพันธ์' ;} 
   if ($month1== '3') { $showmonth1 = 'มีนาคม' ;} 
   if ($month1== '4') { $showmonth1 = 'เมษายน' ;} 
   if ($month1== '5') { $showmonth1 = 'พฤษภาคม' ;} 
   if ($month1== '6') { $showmonth1 = 'มิถุนายน' ;} 
   if ($month1== '7') { $showmonth1 = 'กรกฏาคม' ;} 
   if ($month1== '8') { $showmonth1 = 'สิงหาคม' ;} 
   if ($month1== '9') { $showmonth1 = 'กันยายน' ;} 
   if ($month1== '10') { $showmonth1 = 'ตุลาคม' ;} 
   if ($month1== '11') { $showmonth1 = 'พฤศจิกายน' ;} 
   if ($month1== '12') { $showmonth1 = 'ธันวาคม' ;} 
   
	 if ($month2== '1') { $showmonth2 = 'มกราคม' ;} 
   if ($month2== '2') { $showmonth2 = 'กุมภาพันธ์' ;} 
   if ($month2== '3') { $showmonth2 = 'มีนาคม' ;} 
   if ($month2== '4') { $showmonth2 = 'เมษายน' ;} 
   if ($month2== '5') { $showmonth2 = 'พฤษภาคม' ;} 
   if ($month2== '6') { $showmonth2 = 'มิถุนายน' ;} 
   if ($month2== '7') { $showmonth2 = 'กรกฏาคม' ;} 
   if ($month2== '8') { $showmonth2 = 'สิงหาคม' ;} 
   if ($month2== '9') { $showmonth2 = 'กันยายน' ;} 
   if ($month2== '10') { $showmonth2 = 'ตุลาคม' ;} 
   if ($month2== '11') { $showmonth2 = 'พฤศจิกายน' ;} 
    if ($month2== '12') { $showmonth2 = 'ธันวาคม' ;} 
	$showyear1 = $year1+543;
	$showyear2 = $year2+543;
	?>
  </span>
  <p class="unnamed1"><span class="style2"><strong> <br>
    รายงานวิศวกรรมความปลอดภัยและสภาพแวดล้อมในโรงพยาบาล<br>
    ระหว่างวันที่ &nbsp;&nbsp; <? echo "$day1 $showmonth1 $showyear1" ?> &nbsp;&nbsp;&nbsp; ถึงวันที่ <strong><? echo "$day2 $showmonth2 $showyear2" ?></strong></strong></span><br>
    <br>
  <strong><br>
</strong>  </p>
  <table width="650" border="1" cellpadding="0" cellspacing="0" bordercolordark="#FFFFFF">
    <tr bgcolor="#FFA4FF" class="unnamed1">
      <td height="18" bgcolor="#00CC99"><div align="center" class="style2">ระดับความไม่ปลอดภัย</div></td>
      <td bgcolor="#00CC99"><div align="center" class="style2">จำนวนครั้งที่พบความเสี่ยง</div></td>
    <tr bgcolor="" class="unnamed1">
	<?
		//$sql="select count(s1) ,secur_name FROM secur_data WHERE date BETWEEN '$daymonthyear1' AND '$daymonthyear2' group by secur_name";
		//$sql="select secur_name ,count (s1) FROM secur_data WHERE date BETWEEN '$daymonthyear1' AND '$daymonthyear2' group by secur_name";
		//$result = mysql_query($dbname, $sql) or die(mysql_error());
		//while ($fet = mysql_fetch_array($result))
		//{
		include("config.php");
		$sql="select count(s1) FROM secur_data WHERE date BETWEEN '$daymonthyear1' AND '$daymonthyear2' group by secur_name";
		$result = mysql_query($sql,$link) or die(mysql_error());
		//$counts1= $result[0];
		while ($fet = mysql_fetch_array($result)){
		
	?>
      <td><?php echo $fet['s1' ]; ?></td>
      <td ><?php echo $fet['secur_name ']; ?></td>
<?
}
?>
    <tr class="unnamed1">
  </table>
  <br>
  <br>
  <br>
  <table width="650" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <?php $monthname=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");?>
      <? 		$day =array("วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัส","วันศุกร์","วันเสาร์","วันอาทิตย์");		?>
      <td class="unnamed1"><div align="right">วันที่ออกรายงาน : <? echo $day[date('w')-1]." ".date('d')." ". $monthname[date('n')-1]." ".(date('Y')+543)." เวลา ".date('H:i:s');?></div></td>
    </tr>
  </table>
</div>
</BODY>
</HTML>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-11 11:34:54 By : มือใหม่
 


 

No. 5

Guest


เงียบเลย ช่วยหน่อยครับ ยังไม่ได้เลย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 08:49:22 By : ช่วยหน่อยครับ
 


 

No. 6



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

มันไม่มีข้อมูลหรือเปล่าครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 08:50:56 By : mr.win
 


 

No. 7

Guest


มีข้อมูลครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 10:17:46 By : ช่วยหน่อยครับ
 


 

No. 8



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code (PHP)
$sql="select count(s1) FROM secur_data WHERE date BETWEEN '$daymonthyear1' AND '$daymonthyear2' group by secur_name";

echo $sql;


ลองเอา SQL ที่ได้ไปทดสอบบน phpMyAdmin ครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 10:25:09 By : mr.win
 


 

No. 9

Guest


query ขึ้นครับ

select count(s1) FROM secur_data WHERE date BETWEEN '16/05/2555' AND '18/05/2555' group by secur_name

วันที่ผมเก็บ เป็น 15/05/55
แปลง จาก code ด้านล่าง

Code (PHP)
 <?
		$today = date('d/m/Y');
		 list($day, $month, $year) = split('[/.-]', $today);
		$year = $year + 543;
		$today=  "$day/$month/$year"; ?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 11:15:45 By : ช่วยหน่อยครับ
 


 

No. 10

Guest


แต่มาใช้ php เขียน query ออกรายงาน
ไม่ออกนะครับ ผมตก code ตรงไหนหรือป่าวครับ

ช่วยหน่อยครับ
ขอบคุณครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 11:22:54 By : ช่วยหน่อยครับ
 


 

No. 11



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Format ที่ถุกต้องของ MySQL ที่เป็น Date จะต้องเป็น YYYY-MM-DD ครับ เช่น 2012-06-12
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 11:31:34 By : mr.win
 


 

No. 12

Guest


เปลี่ยน เป็น YYYY-MM-DD เช่น 2012-06-12 แล้วครับ

ยัง แสดงผลจาก php ไม่ได้เลยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 14:03:04 By : ช่วยหน่อยครับ
 


 

No. 13



โพสกระทู้ ( 83 )
บทความ ( 0 )



สถานะออฟไลน์


จากโค้ดในความเห็นที่ 4 บรรทัดที่ 128 มีช่องว่างอยู่นะค่ะ

<td ><?php echo $fet['secur_name ']; ?></td>

ไม่รู้เกี่ยวกันรึป่าว ลองไล่ ๆ โค้ดดูนะค่ะ บางทีติดเรื่อง space นิดเดียวค่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 16:34:44 By : s_ting
 


 

No. 14



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


echo query ออกมาดูก่อน แล้วลองเอาไปรัน phpmyadmin หรือ mysql-front ดูครับ
ว่ารันผ่านมั้ย ถ้าผ่านให้ลองมาไล่ดูที่โค้ด
ถ้ารันไม่ผ่านแก้ซะให้เรียบร้อย แค่นี้ละครับขั้นตอนดีบัก ลองดูก่อนครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-12 16:42:07 By : naskw
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ผมต้องการออกรายงาน เป็น html และ excel พอ submit ไป ขึ้น error ครับ ช่่วยหน่อยครับ Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 02
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่