1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

Discussion in 'PHP' started by abosirage, Nov 14, 2010.

  1. abosirage

    abosirage New Member

    Joined:
    Jul 29, 2010
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    IT
    Location:
    Tripoli-Libya
    hi everybody
    help me please
    I have some php pages it's work perfect in local host but when I run it online I faceed the folowin problem
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in .../view.php on line 11

    viewdb.php code:
    Code:
    <HTML> 
    <div align="center">
    <table border="0" width="63%" id="table1">
    <tr><td>
    <?php 
    include ('config.php');
    $result = mysql_query("SELECT * FROM personnel"); 
    echo "<TABLE BORDER=2>"; 
    echo"<TR><td align=center width=190><B>الاجـــــــراء</B><td align=center width=190><B>الاسم بالكامـــــل</B>
    <td align=center width=220><B>العنــــــــوان</B></TR>"; 
    while($myrow = mysql_fetch_array($result)) 
    { 
    echo "<TR>
    <td align=center width=190><a href=\"view.php?id=".$myrow['id']."\">عرض</a> ";
    echo "<a href=\"delete.php?id=".$myrow['id']."\">حذف</a> ";
    echo "<a href=\"edit.php?id=".$myrow['id']."\">تعديل</ a>";
    echo "<td align=center width=190>".$myrow["firstname"]." ".$myrow["lastname"]."
    </a><td align=center width=190>".$myrow["nick"];
    } 
    echo "</TABLE>"; 
    ?> 
    </td></tr></table></div>
    <p align="center"><b><font size="4"><a href="serch.php">بحـــث</a>&nbsp;&nbsp;
    <a href="input.php">إدخال جديد</a></font></b></p>
    <p>&nbsp;</p>
    </HTML>
    
    so when I click عرض in this line
    <td align=center width=190><a href=\"view.php?id=".$myrow['id']."\">عرض</a> ";
    I recive this error :
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in .../view.php on line 11

    follwig view.php code:
    Code:
    <HTML>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    </head>
    <div align="center" dir="rtl">
    <table border="0" width="65%" id="table1">
    <tr><td><?php 
    include ('config.php');
    mysql_select_db("umma_mydb"); 
    $result = mysql_query("SELECT * FROM personnel WHERE id=$id"); 
    $myrow = mysql_fetch_array($result);
    echo "الاسم : ".$myrow["firstname"]; 
    echo "<br>اللقب : ".$myrow["lastname"]; 
    echo "<br>العنوان : ".$myrow["nick"]; 
    echo "<br>البريد الالكتروني : ".$myrow["email"]; 
    echo "<br>المرتب : ".$myrow["salary"]; 
    ?></td></tr></table>
    <b><span lang="ar-sa"><a href="serch.php">بحــــث</a>&nbsp;&nbsp; <a href="viewdb.php">عودة للقائمة</a></span></b></p>
    </div>
    </HTML>
    what to do with it
     

Share This Page