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 > ช่วยหน่อยครับ Warning: mysql_fetch_array(): ลองที่เครื่องตัวเองไม่มีปัญหา แต่อัพขึ้นโฮสเจอ Error ครับ



 

ช่วยหน่อยครับ Warning: mysql_fetch_array(): ลองที่เครื่องตัวเองไม่มีปัญหา แต่อัพขึ้นโฮสเจอ Error ครับ

 



Topic : 068207



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



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




ช่วยหน่อยครับ ติด Error Warning: mysql_fetch_array(): ครับ ทดลองที่เครื่องตัวเองไม่มีปัญหาครับใช้งานได้ปกติ
แต่พออัพขึ้นโฮสเจอ Error ครับ งงครับ ไม่รู้จะแก้ยังไง รบกวนเพื่อนๆ พี่ๆ น้องๆ ช่วยด้วยครับ


ขึ้น Error แบบนี้ครับ
Quote:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/baanyo/domains/baanyo.com/public_html/modules/vision/shoutbox/shout.php on line 165




Code (PHP)
<?
/*
 +-------------------------------------------------------------------+
 |                      S H O U T B O X   (v1.5)                     |
 |                          P a r t   II                             |
 |                                                                   |
 | Copyright Gerd Tentler               www.gerd-tentler.de/tools    |
 | Created: Jun. 1, 2004                Last modified: Nov. 30, 2005 |
 +-------------------------------------------------------------------+
 | This program may be used and hosted free of charge by anyone for  |
 | personal purpose as long as this copyright notice remains intact. |
 |                                                                   |
 | Obtain permission before selling the code for this program or     |
 | hosting this software on a commercial website or redistributing   |
 | this software over the Internet or in any other medium. In all    |
 | cases copyright must remain intact.                               |
 +-------------------------------------------------------------------+
*/
  error_reporting(E_WARNING);

//========================================================================================================
// Cookies
//========================================================================================================

  if(isset($Name)) {
    $shouter = $Name;
    setcookie('shouter', $shouter);
  }
  if(isset($EMail)) {
    $shouter_mail = $EMail;
    setcookie('shouter_mail', $shouter_mail);
  }

//========================================================================================================
// Includes
//========================================================================================================

  include('config.inc.php');
  include('smilies.inc');

//========================================================================================================
// Set variables, if they are not registered globally; needs PHP 4.1.0 or higher
//========================================================================================================

  if(!isset($Name)) $Name = $_REQUEST['Name'];
  if(!isset($EMail)) $EMail = $_REQUEST['EMail'];
  if(!isset($Text)) $Text = $_REQUEST['Text'];

//========================================================================================================
// Functions
//========================================================================================================

  function db_connect() {
    global $db_name, $db_server, $db_user, $db_pass;

    $status = true;
    if(!@mysql_connect($db_server, $db_user, $db_pass)) {
      echo '<font color=red>' . mysql_errno() . ': ' . mysql_error() . '</font><br>';
      $status = false;
    }
    else if(!@mysql_select_db($db_name)) {
      echo '<font color=red>' . mysql_errno() . ': ' . mysql_error() . '</font><br>';
      $status = false;
    }
    return $status;
  }

  function timeStamp($ts) {
    return substr($ts, 0, 4) . '-' . substr($ts, 4, 2) . '-' . substr($ts, 6, 2) . ' ' . substr($ts, 8, 2) . ':' . substr($ts, 10, 2) . ':' . substr($ts, 12);
  }

  function checkRepeats($str) {
    $newstr = substr($str, 0, 3);

    for($i = 3; $i < strlen($str); $i++) {
      if($str[$i] == $str[$i-1] && $str[$i] == $str[$i-2] && $str[$i] == $str[$i-3]) continue;
      else $newstr .= $str[$i];
    }
    return $newstr;
  }

  function format($str, $sm_code = '', $sm_img = '') {
    global $allowHTML;

    if(!$allowHTML) {
      $str = str_replace('>', '&gt;', $str);
      $str = str_replace('<', '&lt;', $str);
    }
    $str = eregi_replace('http://', '', $str);
    $str = checkRepeats($str);
    if($sm_code && $sm_img) $str = str_replace($sm_code, $sm_img, $str);

    return $str;
  }

//========================================================================================================
// Main
//========================================================================================================

  if(db_connect()) {
    $error = '';

    header('Cache-control: private, no-cache, must-revalidate');
    header('Expires: Sat, 01 Jan 2000 00:00:00 GMT');
    header('Date: Sat, 01 Jan 2000 00:00:00 GMT');
    header('Pragma: no-cache');
?>
    <html>
    <head>
    <meta http-equiv="refresh" content="<? echo $boxRefresh; ?>; URL=<? echo basename($PHP_SELF); ?>">
    <title>Output</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
    $messageOrder = strtoupper($messageOrder);
    if($messageOrder != 'ASC' && $messageOrder != 'DESC') $messageOrder = 'DESC';

    if($messageOrder == 'ASC') {
?>
      <script language="JavaScript"> <!--
      function autoscroll() {
        if(document.body && document.body.offsetHeight) window.scrollBy(0, document.body.offsetHeight);
        else if(window.innerHeight) window.scrollBy(0, window.innerHeight);
        else if(document.height) window.scrollBy(0, document.height);
      }
      window.onload = autoscroll;
      //--> </script>
<?
    }
?>
    <link rel="stylesheet" href="shoutbox.css" type="text/css">
    </head>
    <body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0>
<?
    if($Text) {
      $tstamp = date('YmdHis');
      $sql = "INSERT INTO $tbl_name ($fld_timestamp, $fld_name, $fld_email, $fld_text) ";
      $sql .= "VALUES ('$tstamp', '$Name', '$EMail', '$Text')";
      if(!mysql_query($sql)) $error .= mysql_error() . '<br>';

      $sql = "SELECT $fld_id FROM $tbl_name ORDER BY $fld_timestamp DESC LIMIT 1";
      $id = mysql_result(mysql_query($sql), $fld_id) - $boxEntries;
      if($id > 0) {
        $sql = "DELETE FROM $tbl_name WHERE $fld_id<=$id";
        if(!mysql_query($sql)) $error .= mysql_error() . '<br>';
      }
    }
?>
    <table border=0 cellspacing=0 cellpadding=2 width=100%><tr>
    <td>
<?
    if($error) echo "<font color=red>$error</font><br>";
?>
    <table border=0 cellspacing=0 cellpadding=0 width=100%>
<?
    $sm_code = $sm_img = array();

    while(list($code, $img) = each($sm)) {
      $sm_code[] = $code;
      $sm_img[] = "<img src='smilies/$img' width=15 height=15 align=top>";
    }

    $sql = "SELECT * FROM $tbl_name ORDER BY $fld_timestamp $messageOrder LIMIT $boxEntries";
    $result = mysql_query($sql);

    while($row = mysql_fetch_array($result)) { //บรรทัดที่แจ้ง Error ครับ
      $tstamp = timeStamp($row[$fld_timestamp]);
      $name = $row[$fld_name] ? format($row[$fld_name]) : '???';
      $email = $row[$fld_email];
      $text = format($row[$fld_text], $sm_code, $sm_img);
      $bgcolor = ($bgcolor != '#FFFFFF') ? '#FFFFFF' : '#F6F6F6';
?>
      <tr bgcolor=<? echo $bgcolor; ?>>
      <td class="cssSmall" align=right><font color=#A0A0A0><? echo $tstamp; ?></font></td>
      </tr><tr bgcolor=<? echo $bgcolor; ?>>
      <td class="cssShoutText"><? if($email) echo '<a href="mailto:' . $email . '">'; ?>
      <b><? echo $name; ?>:</b><? if($email) echo '</a>'; ?> <? echo $text; ?></td>
      </tr>
<?
    }
    mysql_close();
?>
    </table>
    </td>
    </tr></table>
    </body>
    </html>
<?
  }
?>




ขอบคุณครับ



Tag : PHP, MySQL, CakePHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-10-18 12:19:14 By : RockyYO View : 771 Reply : 3
 

 

No. 1



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



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


echo $sql แล้วเอาคำสั่งไปรับใน mysql ได้เปล่าครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-10-18 13:10:00 By : avsqlz
 


 

No. 2



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

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

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


ลองตรวจสอบ

SELECT * FROM $tbl_name ORDER BY $fld_timestamp $messageOrder LIMIT $boxEntries

ลองตรวจสอบ $fld_timestamp ด้วย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-10-18 14:42:42 By : onedan
 

 

No. 3



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



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


มันมีปัญหาเฉพาะตอนอยู่บนโฮสครับ แต่พอที่เครื่องผมเองมันก็ปกติดีครับ งงจริงๆครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-10-18 20:20:09 By : RockyYO
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยหน่อยครับ Warning: mysql_fetch_array(): ลองที่เครื่องตัวเองไม่มีปัญหา แต่อัพขึ้นโฮสเจอ Error ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 อัตราราคา คลิกที่นี่