Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/designo/public_html/SsinjinLassen/npcs/npcs_all.php on line 37
I understand this error to a point, but what I dont understand is how the database worked fine up until today. Is this just a glitch or an error in coding.
Also on the bolded section, how would I get this to pull up a more detailed description as I have other fields in the database that I want to pull up once this link is clicked?
Code pertaining to this:
<?php
$dbh=mysql_connect ("localhost", "my_name", "my_pass") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("my_db");
$sql = 'SELECT npc_name , npc_location , npc_type , npc_level '
. ' FROM npcs '
. ' WHERE 1 '
. ' ORDER BY npc_name ASC LIMIT 0, 30';
$res = mysql_query($sql);
?>
<p align=right>To <a href="sub_npcs.php" target="window" onMouseOver="window.status='"Page Title';return true" onMouseOut="window.status='';return true"
onClick="window.open( 'sub_npcs.php','','status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=300,height=500') ; return false">add</a> a NPC.</p>
<center><table width=100% border="1" cellpadding="1" cellspacing="1" bordercolorlight="064A33" bordercolordark="064A33" bordercolor="064A33">
<tr>
<td class=th align=center width=25%>Name</td>
<td class=th align=center width=25%>Location</td>
<td class=th align=center width=25%>Min/Max Level</td>
<td class=th align=center width=25%>Type</td>
</tr>
<?php
while($npc = mysql_fetch_array($res)) {
$Name=$npc['npc_name'];
$Location=$npc['npc_location'];
$Level=$npc['npc_level'];
$Type=$npc['npc_type'];
echo "
<TR><TD><A HREF=\"".$npc["npc_name"]."\" target='blank'>".$npc['npc_name']."</A> </TD>
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>".$npc['npc_location']."</font></td>
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>".$npc['npc_level']."</font></td>
<td><font size='1' face='Verdana, Arial, Helvetica, sans-serif'>".$npc['npc_type']."</font></td>
</tr>";
}
?>
</table>
ok, I have tried the fetch_array, fetch_row, fetch_assoc and changed them according to which I was attempting, so far the error changes to match whichever is after the fetch_.