มัน ERROR Warning: mysql_result(): supplied argument is not a valid MySQL result

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

boyouina
PHP Newbie
PHP Newbie
โพสต์: 1
ลงทะเบียนเมื่อ: 22/09/2012 10:39 am

มัน ERROR Warning: mysql_result(): supplied argument is not a valid MySQL result

โพสต์ที่ยังไม่ได้อ่าน โดย boyouina »

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in E:\ApproveOnline\ac\payment_return.psk9.php on line 304

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\ApproveOnline\ac\payment_return.psk9.php on line 305

อันนี้ CODE คับ

<? include("../phpheader.php"); ?><? $dir="../"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<? include("../title.php"); ?>

<!-- BEGIN .styles -->
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/prettyPhoto.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/tipsy.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/jCarousel.css" type="text/css" media="screen" />

<!--[if IE]>
<link rel="stylesheet" href="css/ie.css" type="text/css" media="screen, projection" />
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" href="css/ie7.css" type="text/css" media="screen" />
<![endif]-->

<link rel="stylesheet" href="../css/colors/black.css" type="text/css" media="screen" /> <!-- COLOR -->
<!-- END .styles -->

<!-- BEGIN .scripts -->
<script type='text/javascript' src='../js/jquery.js'></script>
<script type='text/javascript' src='../js/ui.core.js'></script>
<script type='text/javascript' src='../js/jquery.cycle.all.min.js'></script>
<script type='text/javascript' src='../js/jquery.nivo.slider.pack.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/jquery.prettyPhoto.js'></script>
<script type='text/javascript' src='../js/jquery.jcarousel.min.js'></script>
<script type='text/javascript' src='../js/jquery.tipsy.js'></script>
<script type='text/javascript' src='../js/jquery.arrowFade.js'></script>
<script type='text/javascript' src='../js/ui.tabs.js'></script>
<script type='text/javascript' src='../js/jquery.custom.js'></script>
<script type='text/javascript' src='../js/jquery.tweetable.js'></script>

<script type='text/javascript' src='../js/cufon-yui.js'></script>
<script type='text/javascript' src='../js/waukegan.font.js'></script>
<!-- END .scripts -->

<!-- [favicon] begin -->
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico" />
<link rel="icon" type="image/x-icon" href="../favicon.ico" />
<!-- [favicon] end -->

<script type="text/javascript">
Cufon.replace('h1, h2, h3:not(#footer h3, .title-blog), h4, h5, h6, table th', {fontFamily: 'Waukegan'});
//Cufon.replace('.sidebar-nav a', {fontFamily: 'Champagne', hover: true});

jQuery(document).ready(function($){
$("a[rel^='prettyPhoto']").prettyPhoto({
theme: 'facebook'});
});
</script>

</head>

<body class="no_js">
<? include("../menu.php"); ?>
<!-- END HEADER -->
<? include("../news.php"); ?>

<!-- START SLIDER -->

<script type="text/javascript">
jQuery(document).ready(function($){
$('#nav-slider ul').arrowFade({
speed: 500,
timeout: 5000
});
});
</script>
<!-- END SLIDER -->
<!-- BOX SECTION -->


<!-- START CONTENT -->
<div id="content">

<div class="inner">

<!-- BOX SECTION -->
<label><b><font size="+1" color="#FF0000">โครงการ บ้านชีวา</font></b></label>
<div class="one">
<? if ($_GET['pj'] == '3101')
{
?>
<br /><img src="images/logo/banchiva.png" alt="Easy to customize" class="icon" width="165" height="55" />
<?
}
?>

<h2>Contractor Approve</h2>

<form action="payment_return.cv.php" method="post" name="search">

<font size="2" color="#999999"><b>ค้นหา :: &nbsp;</b></font>

<select name="years" id="years" style="width:90px;">
<option>ปี พ.ศ.</option>
<? for($i=-3;$i<=15;$i++){?>
<option value="<? echo date("Y")+543+$i;?>"><? echo date("Y")+543+$i;?></option>
<? }?>
</select>

<select name="mouth" id="mouth" style="width:70px;">
<option value="00">เดือน</option>
<option value="01">มกราคม</option>
<option value="02">กุมภาพันธ์</option>
<option value="03">มีนาคม</option>
<option value="04">เมษายน</option>
<option value="05">พฤษภาคม</option>
<option value="06">มิถุนายน</option>
<option value="07">กรกฎาคม</option>
<option value="08">สิงหาคม</option>
<option value="09">กันยายน</option>
<option value="10">ตุลาคม</option>
<option value="11">พฤศจิกายน</option>
<option value="12">ธันวาคม</option>
</select>


<select name="timemer" id="timemer" style="width:70px;">
<option value="-">ช่วงเวลา</option>
<option value="15">1-16</option>
<option value="30">16-30</option>
</select>

<input type="submit" value="ค้นหา" />
</form>

<table width="100%" cellpadding="0" cellspacing="0" class="short-table">
<thead>
<tr>
<th style="width:20%; text-align: left;">Contractor</th>
<th style="width:20%; text-align: left;">Number House</th>
<th style="width:20%; text-align: left;">Number Infra</th>
<th style="width:20%; text-align: left;">Number Fence</th>
<th style="width:20%; text-align: left;">Number Other</th>

</tr>
</thead>

<tbody>

<?
if ($_POST['mouth'] == '00')
{
$mounts = "-";
}
elseif ($_POST['mouth'] == '01')
{
$mounts = "มกราคม";
}
elseif ($_POST['mouth'] == '02')
{
$mounts = "กุมภาพันธ์";
}
elseif ($_POST['mouth'] == '03')
{
$mounts = "มีนาคม";
}
elseif ($_POST['mouth'] == '04')
{
$mounts = "เมษายน";
}
elseif ($_POST['mouth'] == '05')
{
$mounts = "พฤษภาคม";
}
elseif ($_POST['mouth'] == '06')
{
$mounts = "มิถุนายน";
}
elseif ($_POST['mouth'] == '07')
{
$mounts = "กรกฎาคม";
}
elseif ($_POST['mouth'] == '08')
{
$mounts = "สิงหาคม";
}
elseif ($_POST['mouth'] == '09')
{
$mounts = "กันยายน";
}
elseif ($_POST['mouth'] == '10')
{
$mounts = "ตุลาคม";
}
elseif ($_POST['mouth'] == '11')
{
$mounts = "พฤศจิกายน";
}
elseif ($_POST['mouth'] == '12')
{
$mounts = "ธันวาคม";
}
?>

<br />
<label><font size="3" color="#666666">สรุปยอด Payment รอบที่ <? echo $timemer = $_POST['timemer'];?> <? echo $mounts;?> <? echo $years = $_POST['years'];?></font></label>
<?

$timemerchk = $timemer;
$mountchk = $_POST['mouth'];;
$yearschk = $years - '543';

if(isset($mouth,$years,$timemer))
{

$pjcode = '3101';
$sqls="select * from app_contractor where pj_code='$pjcode'";
$results = mysql_query($sqls);
while($fetcharrs = mysql_fetch_array($results))
{
$cont = $fetcharrs['ct_code'];
$ctname = $fetcharrs['ct_name'];
?>

<?
if($timemerchk == '15')
{
$datechk_min = $yearschk . "-" . $mountchk . "-" . '1' . " " . '00:00:00';
$datechk_max = $yearschk . "-" . $mountchk . "-" . '16' . " " . '00:00:00';
// เดิม AND date >= '".date('Y-m-1 00:00:00')."' AND date <= '".date('Y-m-15 00:00:00')."'
$sqldoc="select * from document_approve where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";
$sqldocinfra="select * from document_approveinfra where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";
$sqldocfence="select * from document_approvefence where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";
$sqldocother="select * from document_approveother where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";


$count_user = mysql_query("select count(*) from document_approve where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_user = mysql_query("select count(*) from document_approve where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_userinfra = mysql_query("select count(*) from document_approveinfra where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_userfence = mysql_query("select count(*) from document_approvefence where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_userother = mysql_query("select count(*) from document_approveother where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");

$resultsdoc = mysql_query($sqldoc);
$resultsdoc = mysql_query($sqldocinfra);
$user_online = mysql_result($count_user,0);
$user_onlineinfra = mysql_result($count_userinfra,0);
$user_onlinefence = mysql_result($count_userfence,0);
$user_onlineother = mysql_result($count_userother,0);
while($fetcharrsdoc = mysql_fetch_array($resultsdoc))
{
$status = $fetcharrsdoc['status'];
$dateapprove = $fetcharrsdoc['date'];
$iddocument = $fetcharrsdoc['id'];
}
$datestamp = "15";
// เดิม $day = "AND date >= '".date('Y-m-1 00:00:00')."' AND date <= '".date('Y-m-15 00:00:00')."' ";
$day = "AND date >= '$datechk_min' AND date <= '$datechk_max' ";
}

elseif($timemerchk == '30')
{
$datechk_min = $yearschk . "-" . $mountchk . "-" . '16' . " " . '00:00:00';
$datechk_max = $yearschk . "-" . $mountchk . "-" . '30' . " " . '00:00:00';

$sqldoc="select * from document_approve where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";
$sqldocinfra="select * from document_approveinfra where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";
$sqldocfence="select * from document_approvefence where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";
$sqldocother="select * from document_approveother where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' order by id asc ";


$count_user = mysql_query("select count(*) from document_approve where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_user = mysql_query("select count(*) from document_approve where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_userinfra = mysql_query("select count(*) from document_approveinfra where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_userfence = mysql_query("select count(*) from document_approvefence where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$count_userother = mysql_query("select count(*) from document_approveother where ct_code='$cont' and status = '2' AND date >= '$datechk_min' AND date <= '$datechk_max' ");
$resultsdoc = mysql_query($sqldoc);
$resultsdoc = mysql_query($sqldocinfra);
$user_online = mysql_result($count_user,0);
$user_onlineinfra = mysql_result($count_userinfra,0);
$user_onlinefence = mysql_result($count_userfence,0);
$user_onlineother = mysql_result($count_userother,0);
while($fetcharrsdoc = mysql_fetch_array($resultsdoc))
{
$status = $fetcharrsdoc['status'];
$dateapprove = $fetcharrsdoc['date'];
$iddocument = $fetcharrsdoc['id'];
}
$day = "AND date >= '$datechk_min' AND date <= '$datechk_max' ";
$datestamp = "16";
date('Y',strtotime($dateapprove));
}
if(empty($iddocument))
{
$sqldoc="select * from document_approve where ct_code='$cont' and status = '2' $day order by id asc ";
$sqldocinfra="select * from document_approveinfra where ct_code='$cont' and status = '2' $day order by id asc ";
$sqldocfence="select * from document_approvefence where ct_code='$cont' and status = '2' $day order by id asc ";
$sqldocother="select * from document_approveother where ct_code='$cont' and status = '2' $day order by id asc ";

$count_user = mysql_query("select count(*) from document_approve where ct_code='$cont' and status = '2' $day ");
$count_userinfra = mysql_query("select count(*) from document_approveinfra where ct_code='$cont' and status = '2' $day ");
$count_userfence = mysql_query("select count(*) from document_approvefence where ct_code='$cont' and status = '2' $day ");
$count_userother = mysql_query("select count(*) from document_approveother where ct_code='$cont' and status = '2' $day ");
$resultsdoc = mysql_query($sqldoc);
$user_online = mysql_result($count_user,0);
while($fetcharrsdoc = mysql_fetch_array($resultsdoc))
{
$status = $fetcharrsdoc['status'];
$dateapprove = $fetcharrsdoc['date'];
$iddocument = $fetcharrsdoc['id'];
}
$datestamp = $datestamp;
}
if(date('d',strtotime($dateapprove)) <= 15)
{
$date_day = '15';
}
else
{
$date_day = '16';
}
?>

<? if($status=='2')
{
?>
<tr>
<td><?=$ctname?></a></td>
<td><?=$user_online?></a></td>
<td><?=$user_onlineinfra?></a></td>
<td><?=$user_onlinefence?></a></td>
<td><?=$user_onlineother?></a></td>
</tr>
<?
}
$status=0;?>

<?
}
}
?>

</tbody>
</table>
</div>



<!-- END BOX SECTION -->

<!-- BOX SECTION --><!-- END BOX SECTION -->

<!-- BOX SECTION -->

<!-- <div class="clear"></div>
<h4>Detailed records.</h4>
<div class="two-third"><p>บันทึกรายละเอียด สรุปยอด Payment จ่ายผู้รับเหมา</p></div>
<div class="one-third last">
<p>[ <a href="#">บันทึกทั้งหมด</a> ]</p></div> -->
<!-- BOX CALL TO ACTION --><!-- END BOX CALL TO ACTION -->
<div class="clear"></div>



<!-- BOX SECTION --><!-- END BOX SECTION -->

<!-- BOX SECTION --><!-- END BOX SECTION -->

<!-- BOX SECTION --><!-- END BOX SECTION --></div>

</div>
<!-- END CONTENT -->

<!-- START FLASH NEWS -->
<!-- START NAV SLIDER -->
<? //include("../nav.php"); ?>

<div class="clear"></div>
</div>
<!-- END NAV SLIDER -->
<!-- END FLASH NEWS -->

<!-- START FOOTER --><!-- END FOOTER -->


<!-- START COPYRIGHT -->
<? include("../footer.php");?>
<!-- END COPYRIGHT -->

<script type="text/javascript">
//<![CDATA[
Cufon.now(); //]]>
</script>



<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8632327-9']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

</body>
</html>
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: Google [Bot] และบุคลทั่วไป 105