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 > ช่วยดูหน่อยคับ mysql_fetch_array(): supplied argument is not a valid MySQL result resource



 

ช่วยดูหน่อยคับ mysql_fetch_array(): supplied argument is not a valid MySQL result resource

 



Topic : 079304



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

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

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




Code (PHP)
<?php
// Connect to database
include_once "scripts/connect.php";
// Gather all the members for temporary display
$sql = mysql_query("SELECT id, firstname, lastname FROM myMembers WHERE email_activated='1' ORDER BY id DESC LIMIT 6");

$MemberDisplayList = '<table border="0" align="center" cellpadding="6">
              <tr>  ';

while($row = mysql_fetch_array($sql)){

	$id = $row["id"];
	$firstname = $row["firstname"];
	$lastname = $row["lastname"];
    $firstname = substr($firstname, 0, 10);
	///////  Mechanism to Display Pic. See if they have uploaded a pic or not  //////////////////////////
	$check_pic = "members/$id/image01.jpg";
	$default_pic = "members/0/image01.jpg";
	if (file_exists($check_pic)) {
    $user_pic = "<img src=\"$check_pic\" width=\"80px\" border=\"0\" />"; // width attribute forces picture to be 80px wide and no more
	} else {
	$user_pic = "<img src=\"$default_pic\" width=\"80px\" border=\"0\" />"; // width attribute forces default picture to be 80px wide and no more
	}
	
	$MemberDisp=layList. '<td><div style=" height:80px; overflow:hidden;"><a href="http://www.webintersect.com/profile.php?id=' . $id . '">' . $user_pic . '</a></div><a href="http://www.webintersect.com/profile.php?id=' . $id . '"><div align="center" style=" width:80px; overflow:hidden;">' . $firstname . '</div></a></td>';

} // close while loop

$MemberDisplayList .= '              </tr>
            </table>  ';
?>
<?php
$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date FROM blabbing ORDER BY blab_date DESC LIMIT 20");

while($row = mysql_fetch_array($sql_blabs)){
	
	$blabid = $row["id"];
	$uid = $row["mem_id"];
	$the_blab = $row["the_blab"];
	$blab_date = $row["blab_date"];
	$blab_date = strftime("%b %d, %Y, %Y %I:%M:%S %p", strtotime($blab_date));
	// Inner sql query
	$sql_mem_data = mysql_query("SELECT id, firstname, lastname FROM myMembers WHERE id='$uid' LIMIT 1");
	while($row = mysql_fetch_array($sql_mem_data)){
			$uid = $row["id"];
			$ufirstname = $row["firstname"];
			$ulastname = $row["lastname"];
			$ufirstname = substr($ufirstname, 0, 10);
			///////  Mechanism to Display Pic. See if they have uploaded a pic or not  //////////////////////////
			$ucheck_pic = "members/$uid/image01.jpg";
			$udefault_pic = "members/0/image01.jpg";
			if (file_exists($ucheck_pic)) {
			$blabber_pic = "<img src=\"$ucheck_pic\" width=\"40px\" border=\"0\" />"; // forces picture to be 100px wide and no more
			} else {
			$blabber_pic = "<img src=\"$udefault_pic\" width=\"40px\" border=\"0\" />"; // forces default picture to be 100px wide and no more
			}
	
			$blabberDisplayList .= '
			<table width="90%" align="center" cellpadding="4" bgcolor="#A6D2FF">
        <tr>
          <td width="7%" bgcolor="#FFFFFF"><a href="http://www.webintersect.com/profile.php?id=' . $uid . '">' . $blabber_pic . '</a><br />
          </td>
          <td width="93%" bgcolor="#D9ECFF"><a href="http://www.webintersect.com/profile.php?id=' . $uid . '">' . $ufirstname . ' ' . $ulastname . '</a> &bull; <span style="font-size:10px; font-weight:bold; color:#A6A6A6;">' . $blab_date . '</span><br />
          ' . $the_blab . '</td>
        </tr>
      </table>';
			}
	
}
?>
<!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=iso-8859-1" />
<meta name="Description" content="Page Description goes here" />
<meta name="Keywords" content="Page Keywords go here" />
<meta name="rating" content="General" />
<meta name="revisit-after" content="7 days" />
<meta name="ROBOTS" content="All" />
<title>your new cool site</title>
<link href="style/main.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="http://www.yournewcoolsite.com/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.yournewcoolsite.com/favicon.ico" type="image/x-icon" />
</head>

<body>
<?php include_once "header_template.php"; ?>
<table width="950" align="center">
  <tr>
    <td width="758" valign="top"><p align="center"><br />
        NEWEST MEMBERS<br />
        <?php  print "$MemberDisplayList"; ?></p>
      <table width="92%" align="center" cellpadding="6">
        <tr>
          <td width="100%"><strong>MEMBER BLABS - These are the smartest people on Earth blabbing about stuff. Their mind power cannot be matched.</strong></td>
        </tr>
      </table>
      
<!--      
 <table width="90%" align="center" cellpadding="4" bgcolor="#A6D2FF">
        <tr>
          <td width="10%" bgcolor="#FFFFFF"><a href="http://www.webintersect.com/profile.php?id=' . $uid . '">' . $blabber_pic . '</a><br />
          </td>
          <td width="90%" bgcolor="#D9ECFF"><a href="http://www.webintersect.com/profile.php?id=' . $uid . '">' . $ufirstname . ' ' . $ulastname . '</a> &bull; <span style="font-size:10px;">' . $blab_date . '</span><br />
          ' . $the_blab . '</td>
        </tr>
      </table> -->
      
        <div style="width:100%; height:240px; overflow:auto; overflow-x:hidden;">
        <?php print "$blabberDisplayList"; ?>
        </div>

      <br />
      <br /></td>
    <td width="180" valign="top"><?php include_once "right_AD_template.php"; ?></td>
  </tr>
</table>
<?php include_once "footer_template.php"; ?>
</body>
</html>





Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-06-03 01:14:46 By : nukedonut1 View : 944 Reply : 2
 

 

No. 1

Guest


มีปัญหาที่คำสั่ง select น่ะ ลองเช็คคำสั่งใหม่ดูนะ หรือเอาคำสั่งไปรันใน phpmyadmin ดูว่าทำงานได้ไหม






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-03 07:41:39 By : บังเอิญผ่านมาเห็น
 


 

No. 2



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

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

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

Code (PHP)
$sql = " SELECT id, firstname, lastname FROM myMembers WHERE email_activated='1' ORDER BY id DESC LIMIT 6 ";
$result = mysql_query($sql) or die(mysql_error());


ลองใส่ mysql_error() ดูว่า error อะไรครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-06-03 07:42:01 By : mr.win
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูหน่อยคับ mysql_fetch_array(): supplied argument is not a valid MySQL result resource
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 03
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 อัตราราคา คลิกที่นี่