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 3 of 3
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    error please help

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /Users/avertstaff/Sites/johns/test/display.php on line 12

    Code:
    <style type="text/css">
    <!--
    @import url("style.css");
    -->
    </style>
    <?php
    
    include_once("config.php");
    
    $result = mysql_query("SELECT * FROM assessment ORDER BY ");
    
    while($row = mysql_fetch_array($result))
    
      //{
     //echo '<div id="entry">' . '<div class="entry_header">' . "Name: " . $row['FirstName'] . ' ' . $row['LastName'] . '<br>' . "Page: " . '<a   href='$row['page'] . '>' . $row['page'] . '</a>' . '</div>' . '</div>';
      //}
    
    
    {
    echo '<div id="entry">';
    $name = $row['Assessor'];
    $page = $row['page'];
    $Date = $row['Dateadded'];
    
    $output =<<<EOF
      <div class="entry_header">
        Assessor: $name<br />
        Page to be modified: <a href="http://www.avert.org/$page">$page</a> | <a href="http://cms.avert.org/webpages/edit/$page">edit page</a>
      </div>
    EOF;
    echo $output;
    echo '</div>';
    }
    
    echo '<a href="post.php">Add new</a>'; 
    mysql_close($link);
    ?>
    line 12:
    Code:
    while($row = mysql_fetch_array($result))

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    $result = mysql_query("SELECT * FROM assessment ORDER BY ");

    ORDER BY WHAT?

  • #3
    Regular Coder
    Join Date
    Dec 2007
    Location
    Nebraska
    Posts
    113
    Thanks
    0
    Thanked 2 Times in 2 Posts
    That's correct, your query is failing. Even when you get the syntax corrected however, you still should not assume that it will execute every time. If a table was deleted or corrupted during a backup or altered accidentally or because of an attack on the system, you might still get an error that will stop your application and possibly reveal more information to an attacker. Every MySQL function returns a value that evaluates to false when something goes wrong. Use an if construct to determine if the call to the function was successful before going on. If there is an error, you can then handle it gracefully.
    Deliver yesterday, code today, think tomorrow.


  •  

    Posting Permissions

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