...

View Full Version : error please help



jarv
05-15-2008, 02:53 PM
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /Users/avertstaff/Sites/johns/test/display.php on line 12



<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:
while($row = mysql_fetch_array($result))

Iszak
05-15-2008, 02:54 PM
$result = mysql_query("SELECT * FROM assessment ORDER BY ");

ORDER BY WHAT?

hammer65
05-15-2008, 05:43 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum