ช่วยหน่อย ครับ มัน ERROR แบบนี้
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\tsc\thaismart\view_log\query_all.php on line 77
.......................................................................................
<!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=tis-620">
<title> </title>
</head>
<body>
<
<h4> Search LOG <h4>
<center>
<TABLE class="tablemanager">
<form action="query_all.php" method="post" name="testform" >
<p>
จาก
<input name="dc" size="11">
<a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fPopCalendar(document.testform.dc);return false;" ><img class="PopcalTrigger" align="absmiddle" src="PopCalendarXP/calbtn.gif" width="34" height="22" border="0" alt=""></a> <span class="style15"> ถึง
<input name="dc2" id="dc2" size="11">
<a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fPopCalendar(document.testform.dc2);return false;" ><img class="PopcalTrigger" align="absmiddle" src="PopCalendarXP/calbtn.gif" width="34" height="22" border="0" alt=""></a> </span><!--<input type="submit" name="Submit" value="Submit">-->
</p>
<p> </p>
<!-- PopCalendar(tag name and id must match) Tags should not be enclosed in tags other than the html body tag. -->
<iframe width=174 height=189 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="PopCalendarXP/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
</iframe>
กรุณากรอกหมายเลข MID<br />
<input class="textfield" type="text" name="MERCHANT" id="textfield" />
กรุณากรอกหมายเลข TID<br />
<input class="textfield" type="text" name="TERMINAL" id="textfield" />
<input class="button_gray" type="submit" name="button" id="button" value="Query" />
</form>
<br /><br />
<?
include "../connect.php";
if($TERMINAL=="" && $MERCHANT=="" && $dc=="" && $dc2==""){
echo"<center><h2> Insert DATA !!</h2><br><br><br><center>"; exit();
}else if($TERMINAL!="" && $MERCHANT=="" && $dc=="" && $dc2==""){
$sql="select * from logs where TERMINAL='$TERMINAL'";
}else if($TERMINAL=="" && $MERCHANT!="" && $dc=="" && $dc2==""){
$sql="select * from logs where MERCHANT='$MERCHANT'";
}else if($TERMINAL!="" && $MERCHANT!="" && $dc=="" && $dc2=="") {
$sql="select * from logs where TERMINAL='$TERMINAL' && MERCHANT='$MERCHANT'";
}else if($TERMINAL!="" && $MERCHANT!="" && $dc!="" && $dc2=="") {
echo"<center><h2> กรุณากรอก วันสิ้นสุด</h2><br><br><br><center>"; exit();
}else if($TERMINAL!="" && $MERCHANT!="" && $dc=="" && $dc2!="") {
echo"<center><h2> กรุณากรอก วันเริ่มต้น</h2><br><br><br><center>"; exit();
}else if($TERMINAL!="" && $MERCHANT!="" && $dc!="" && $dc2!="") {
$sql="select * from logs where TERMINAL='$TERMINAL' && MERCHANT='$MERCHANT' && DATETIME BEETWEEN '$dc' AND '$dc2'" ;
}
$result=mysql_db_query($dbname,$sql);
$num=mysql_num_rows($result);
if ($num<=0) {
echo"<center>TID $TERMINAL NO DATA</center>";
}else{
echo"<table class=\"tablemanager\">";
echo"<tr class=\"yellow\" ><td>LOG_DATE</td><td>MERCHANT</td><td>TERMINAL</td><td>APPVER </td><td>CRC </td><td> IP</td></tr>";
while($rs=mysql_fetch_array($result)){
$LOG_DATE=$rs[LOG_DATE];
$MERCHANT=$rs[MERCHANT];
$TERMINAL=$rs[TERMINAL];
$APPVER=$rs[APPVER];
$CRC=$rs[CRC];
$IP=$rs[IP];
echo"<tr><td align=center> $LOG_DATE</td><td> $MERCHANT</td><td> $TERMINAL</td><td>$APPVER </td><td>$CRC </td><td> $IP</td></tr>";
}
echo"</table>";
}
?>
</TABLE>
<br /><h2>
</body>
</html>
BEETWEEN = BETWEEN
่อ่อ แก้แล้ว ครับ เหมือนเดิม อ่า
line 77 อยุ่ตรงไหนคับ
echo $sql ออกมา แล้วเอาไปทดสอบบน phpmyadmin ก็รู้เองแหละมั้ง