Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question mysql_fetch_row(): supplied argument is not a valid MySQL result resource ...

    Good morning!

    I'm running a calendar module for Php-Nuke 7.5... I receive the above mentioned error when I try to Edit or Delete a previous calender entry.

    It's pointing to a link in a php file, below is the line that is causing the problem.

    list($counter, $radminarticle, $radminsuper) = mysql_fetch_row($result);

    I've checked my database and it looks fine. I've also removed the databases and re-added them back.

    This snippet of code seems to cause the same problem if I try to edit or delete an entry... Posting and viewing are fine.

    Appreciate the help!

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query?

    The error indicates that $result does not contain a valid result set; can we see the query that creates that result, and possibly the definition of the table the query is executed against?
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #3
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think this is what you are looking for... (and thanks for the quick response!)

    Code:
    function CalendarRemoveStory($eid, $ok=0) {
        global $module_name, $aid, $dbi, $db, $prefix;
        $result = mysql_query("select counter, radminarticle, radminsuper from ".$prefix."_authors where aid='$aid'");
        list($counter, $radminarticle, $radminsuper) = mysql_fetch_row($result);
        $result2 = mysql_query("select aid from ".$prefix."_4ncal where eid='$eid'");
        list($aaid) = mysql_fetch_row($result2);
        if (($radminarticle == 1) AND ($aaid == $aid) OR ($radminsuper == 1)) {
            if($ok) {
                $counter--;
                    mysql_query("DELETE FROM ".$prefix."_4ncal where eid=$eid");
                $result = mysql_query("update ".$prefix."_authors set counter='$counter' where aid='$aid'");
                Header("Location: modules.php?op=modload&name=$module_name&file=index");
            } else {
                include("header.php");
                GraphicAdmin($hlpfile);
                OpenTable();
                echo "<center>"._4ncaltitle."<br><font size=\"4\"><b>"._CALSUBMISSIONSADMIN."</b></font></center>";
                CloseTable();
                echo "<br>";
                OpenTable();
                echo "<center>"._CALREMOVETEST." $eid<br>";
                echo "<br>[ <a href=\"modules.php?op=modload&name=$module_name&file=index\">"._CALNO."</a> | <a href=\"admin.php?op=CalendarRemoveStory&eid=$eid&ok=1\">"._CALYES."</a> ]</center>";
                    CloseTable();
                include("footer.php");
            }
        } else {
            include ('header.php');
            GraphicAdmin($hlpfile);
            OpenTable();
            echo "<center><font size=\"4\"><b>"._CALSUBMISSIONSADMIN."</b></font></center>";
            CloseTable();
            echo "<br>";
            OpenTable();
            echo "<center><b>"._CALNOTAUTHORIZED1."</b><br><br>"
                .""._CALNOTAUTHORIZED2."<br><br>";
            CloseTable();
            include("footer.php");
        }
    }

  • #4
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    change this line:
    PHP Code:
     $result mysql_query("select counter, radminarticle, radminsuper from ".$prefix."_authors where aid='$aid'"); 
    to
    PHP Code:
     $result mysql_query("select counter, radminarticle, radminsuper from ".$prefix."_authors where aid='$aid'") or die(mysql_error()); 
    it wont fix the problem but it *should* tell you whats going wrong.

  • #5
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, Nancy...

    Here is the result:

    Unknown column 'radminarticle' in 'field list'

  • #6
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    ok.... well the error is pretty descriptive.
    Your table doesnt have a radminarticle field.
    If you're sure the field is there then echo out the query
    PHP Code:
    echo "select counter, radminarticle, radminsuper from ".$prefix."_authors where aid='$aid'"
    That will tell you what tablename its looking at.

  • #7
    New to the CF scene
    Join Date
    Feb 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Awesome... well... kinda awesome...

    I found exactly what the problem, thanks to your help! I did some digging on the query that I posted about the missing column... Seems like I have incompatible versions... The script was written in German; so it's a bit tricky to find help... hehe

    Thanks again for your help. I'm going to copy that one snippet down; seems like its a great troubleshooting technique.


  • #8
    New to the CF scene
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    mysql_fetch_row(): supplied argument is not a valid MySQL result resource in

    i have a problem also..pls help me,,this is the code..the problem is,,in line 34..it is a website,,so many erros i dont know what to do with this errors..

    PHP Code:
    <?
    include('config.php');
    $query "SELECT TOP 5 Name,Reset from Character order by Reset desc";
    $result mysql_query($query);
    echo 
    '<TABLE border=0 cellPadding=0 cellSpacing=0 >
                              <TBODY>
                              <TR>
                                
                             
        <TD align=left vAlign=top><A 
                                   
                                  
      </TR>
                              <TR>
                                <TD align=left  
                                vAlign=top>
                                  <TABLE border=0 cellPadding=10 cellSpacing=0 
                                
                                    <TBODY>
                                    <TR>
                                    
              <TD align=middle vAlign=center>
                <table height=30 cellspacing=0 cellpadding=0
                                    width=150 border=0 >
                  <tbody
                  <tr> 
               <td valign=top align=left width=0 height=0><span class="style50">#</td>
               <td valign=top align=left width=0><span class="style50">Name</td>
               <td valign=top align=center width=0><span class="style50">Resets</td>
    </tr>'
    ;

    for (
    $num_rows = (mysql_num_rows);($result);++$i);
    {
    $num_rows mysql_fetch_row ($result2);

    $rank $i+10;

    echo 
    "<tr><td valign=top align=left><span class='style50'>$rank.</td>
    <td valign=top align=left><span class='style50'>$row[0]</td>
    <td valign=top align=center><span class='style50'>$row[1]</td>

    </tr>"
    ;
    }
       
               

    ?>
                      </tbody> 
                    </table>
                    
                    </TD>
            </TR></TBODY></TABLE></TD></TR>
                              <TR>
                                 
                              </TD></TR></TBODY></TABLE>


    Total Accounts:
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 364
    Total Characters:
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 371
    Total Guilds:
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 378
    Users Connected:
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 388

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 390

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\index.php on line 405

  • #9
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Read the whole post, especially the fourth one
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •