Jump to content

SQL error, HELP!


Benan

Recommended Posts

hi,

Im running a script called 0day DB, and im just confgiruing everything..When I went to "Submitted downloads" page in my Admin Control Panel, I got an SQL error saying:

[quote]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/freddy/public_html/acp/submitted.php on line 81

Page:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/freddy/public_html/acp/submitted.php on line 67[/quote]

Here is the code to that page:
[code]
<? require('access.php'); ?>
<link rel="stylesheet" type="text/css" href="images/0daydb.css" />
<title>0DayDB Admin Control Panel</title>
<style type="text/css">
<!--
.style3 {font-size: 12px;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style4 {font-size: 10px}
.style7 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style8 {color: #000000}
-->
</style>
<div align="center">
  <table class="border" width="81%">
    <tr>
      <td width="20%" valign="top" align="left">
     
   
      <div class="border">
  <div class="title">:: Navigation</div>
  <div class="sex">
  <div align="left"><strong>&raquo; Main</strong><br>
  » <a href="../index.php">Site Home</a><br>
  &raquo; <a href="admin.php">Admin Home</a><br>
  &raquo; <a href="http://d0xscripts.com/viewforum.php?f=12">Support</a><br>
    <br>
    <strong>&raquo; Downloads</strong><br>
  &raquo; <a href="submit.php">Submit Downloads</a><br>
  &raquo; <a href="remove.php">Remove Downloads</a><br>
  &raquo; <a href="submitted.php">Submitted Downloads </a><br>
    <br>
    <strong>&raquo; Tools</strong><br>
  &raquo; <a href="auto.php">AutoSubmitter</a><br>
  &raquo; <a href="ban.php">Ban IPs</a><br>
  &raquo; <a href="stats.php">Site Stats</a><br>
    &raquo; <a href="multiup.php">Multi Upload</a><br>
    <br>
    <strong>&raquo; News</strong><br>
  &raquo; <a href="addnews.php">Add News</a><br>
  &raquo; <a href="removenews.php">Remove News</a></div>
  </div>
  </div>
 
    </td>
      <td width="80%" valign="top">    <div class="border">
        <div class="title">:: Submitted</div>
        <div class="sex">
          <div align="justify">these are the downloads that guests have submitted to your site! you must cllck the download and find the file info of the item that has been added. enjoy!<br>
              <br>
              Notice: for the next version we will make it so you can just submit them strate into your download list from here. <br>
          </div>
        </div>
      </div>
        <div class="border">
          <div class="title">:: Submitted Downloads </div>
          <div class="sex">
            <?
include("../dbconnect.php");

if(!$_GET[page]) $_GET[page]=1;
$start = ($_GET[page]-1)*$limit;

function pagelinks($ispage=1,$getme = "order by id DESC"){
global $limit;
$indb = mysql_numrows(mysql_query("SELECT * FROM guestsubmit $getme"));
$pagenumber = $indb / $limit;
$pagenumber++;
$pagecnt=1;
while($pagecnt <= $pagenumber)
{
if($pagecnt == $ispage){echo "[ $pagecnt ] ";}
else{echo "<a href=\"submitted.php?page=$pagecnt\" target=_self>$pagecnt</a>\n ";}
$pagecnt++;
}
}

$result = mysql_query("select * from guestsubmit order by id DESC limit $start,$limit");

while($r=mysql_fetch_array($result))
{
 
  $id=$r["id"];
  $title=$r["title"];
  $date=$r["date"];
  $description=$r["description"];
  $link=$r["link"];
 
  //display the row
echo ("<a href='dl.php?id=$id'>$title</a><br>");
}

echo"<br>Page: \n";
pagelinks($_GET[page]);

?>
          </div>
      </div></td>
    </tr>
  </table>
  Powered By <strong><a href="http://www.d0xscripts.com">0DayDB v2.3</a></strong></div>[/code]

[b]while($r=mysql_fetch_array($result))[/b] [i][b]<- Page 81[/b][/i]

[b]$indb = mysql_numrows(mysql_query("SELECT * FROM guestsubmit $getme"));[/b] [i][b]<- Page 67[/b][/i]

Can some one please help me out here?



Link to comment
https://forums.phpfreaks.com/topic/22324-sql-error-help/
Share on other sites

Try replacing this:

[code]$indb = mysql_numrows(mysql_query("SELECT * FROM guestsubmit $getme"));[/code]

With this:

[code]$query = "SELECT * from guestsubmit ". $getme;
$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); // what went wrong?
$indb = mysql_numrows($result);[/code]
Link to comment
https://forums.phpfreaks.com/topic/22324-sql-error-help/#findComment-100005
Share on other sites

Done that and i get this now:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/freddy/public_html/acp/submitted.php on line 83

Page: Error: Table 'freddy_ddl.guestsubmit' doesn't exist with query SELECT * from guestsubmit order by id DESC
Link to comment
https://forums.phpfreaks.com/topic/22324-sql-error-help/#findComment-100022
Share on other sites

You either have to create the table and populate it with the data you need or you have to figure out which table the script is supposed to be pointing at and change the name to that table.
As for how to do that, I recommend reading this: [url=http://dev.mysql.com/doc/refman/4.1/en/index.html]http://dev.mysql.com/doc/refman/4.1/en/index.html[/url]
Link to comment
https://forums.phpfreaks.com/topic/22324-sql-error-help/#findComment-100456
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.