Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\project2\index.php on line 223
โค๊ด
<?php
include "config.php";
include "paging.php";
$current_page = 1;
if(isset($_GET['page'])){
$current_page = $_GET['page'];
}
$rows_per_page =15;
$start_row = paging_start_row($current_page, $rows_per_page);
$sql = "select position, pnum, availability, required, salary, welfare from statistics order by statistics_id LIMIT $start_row,$rows_per_page;";
$result = mysql_query($sql);
$found_rows = mysql_query("select found_rows();");
$total_rows = mysql_result($found_rows, 0, 0);
$total_pages = paging_total_pages($total_rows, $rows_per_page);
$num=mysql_num_rows($result);
$no=0;
if($num>0){
echo "
<TABLE BORDER='1' cellspacing='0' width='900' height='100' bordercolor='#FFFFFF'>
<tr bgcolor=#33CCFF >
<td width='50' align='center'><font color='#000000'>ตำแหน่ง</font></td>
<td width='50' align='center'><font color='#000000'>อัตรา</font></td>
<td width='50' align='center'><font color='#000000'>ความสามารถ</font></td>
<td width='50' align='center'><font color='#000000'>คุณสมบัติ</font></td>
<td width='50' align='center'><font color='#000000'>เงินเดือน</font></td>
<td width='100' align='center'><font color='#000000'>สิทธิประโยชน์/font></td>
</tr>";
$bgcolor1 = "#eeeeff";
$bgcolor2 = "#ddeeff";
$bgcolor = $bgcolor1;
while($r=mysql_fetch_array($result)){
$bgcolor = ($bgcolor == $bgcolor1) ? $bgcolor2 : $bgcolor1;
$position=$r[position];
$pnum=$r[pnum];
$availbility=$r[availability];
$required = $r[required];
$salary = $r[salary];
$welfare = $r[welfare];
$no++;
echo "
<tr bgcolor=$bgcolor valign=top>
<td><center><font color='#000000'>$position</font></center></td>
<td><center><font color='#000000'>$pnum</font></center></td>
<td><center><font color='#000000'>$availbility</font></center></td>
<td><center><font color='#000000'>$required</font></center></td>
<td><center><font color='#000000'>$salary</font></center></td>
<td><center><font color='#000000'>$welfare</font></center></td>
</tr>";
}
}
?>
mysql_num_rows(): supplied argument is not a valid MySQL result resource
Moderators: mindphp, ผู้ดูแลกระดาน
Re: mysql_num_rows(): supplied argument is not a valid MySQL result resource
ช่วยแก้ให้หน่อยนะค่ะ พอดีมือใหม่อะค่ะ
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27210
- Joined: 22/09/2008 6:18 pm
- Contact:
Re: mysql_num_rows(): supplied argument is not a valid MySQL result resource
เช็คคำสั่ง $sql
ว่าถูกต้องหรือเปล่า และ query สองครั้งต้องการเอาครั้งไหน มานับ
ว่าถูกต้องหรือเปล่า และ query สองครั้งต้องการเอาครั้งไหน มานับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
- webseo2go
- PHP Newbie
- Posts: 8
- Joined: 17/04/2012 7:03 pm
Re: mysql_num_rows(): supplied argument is not a valid MySQL result resource
ที่เจอแบบนี้เคยบ่อยครับ sql ผิดครับ ไม่มีชื่อฟิลด์นั้นในตารางครับ ไม่ก็ผิด type อ่ะครับ
-
- Similar Topics
- Replies
- Views
- Last post
-
-
ช่วยหน่องครับ Warning: mysql_num_rows(): supplied argument is not a valid MySQL
by knzkidz » 28/10/2014 5:35 pm » in Programming - PHP - 7 Replies
- 13199 Views
-
Last post by knzkidz
29/10/2014 8:18 am
-
-
-
มัน ERROR Warning: mysql_result(): supplied argument is not a valid MySQL result
by boyouina » 22/09/2012 10:42 am » in Programming - PHP - 0 Replies
- 17101 Views
-
Last post by boyouina
22/09/2012 10:42 am
-
-
-
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result reso
by sutawee » 19/01/2013 9:14 pm » in Programming - PHP - 1 Replies
- 2782 Views
-
Last post by mindphp
19/01/2013 9:40 pm
-
-
-
ตรวจ code php mysql ให้ทีครับ Warning: mysql_num_rows(): supplied argument is no
by Dwight » 09/12/2011 9:57 am » in Programming - PHP - 6 Replies
- 5327 Views
-
Last post by Dwight
12/12/2011 10:07 pm
-
-
-
ช่วยด้วยครับ Warning: mysql_fetch_array(): supplied argument is not a valid MySQ
by jo23748 » 20/11/2011 1:08 pm » in Programming - PHP - 1 Replies
- 2201 Views
-
Last post by mindphp
21/11/2011 6:42 pm
-
Who is online
Users browsing this forum: Bing [Bot] and 11 guests