...

View Full Version : mysql_fetch_row(): supplied argument is not a valid MySQL result resource ...



search66
02-10-2006, 01:19 PM
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!

ronaldb66
02-10-2006, 01:24 PM
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?

search66
02-10-2006, 01:27 PM
I think this is what you are looking for... (and thanks for the quick response!)


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");
}
}

NancyJ
02-10-2006, 01:36 PM
change this line:

$result = mysql_query("select counter, radminarticle, radminsuper from ".$prefix."_authors where aid='$aid'");
to

$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.

search66
02-10-2006, 01:41 PM
Thanks, Nancy...

Here is the result:

Unknown column 'radminarticle' in 'field list'

NancyJ
02-10-2006, 02:04 PM
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


echo "select counter, radminarticle, radminsuper from ".$prefix."_authors where aid='$aid'";
That will tell you what tablename its looking at.

search66
02-10-2006, 02:11 PM
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.

:)

satsuma
05-31-2011, 07:51 AM
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..


<?
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

abduraooft
05-31-2011, 08:16 AM
Read the whole post, especially the fourth one (http://www.codingforums.com/showpost.php?p=407953&postcount=4)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum