Jump to content


Photo

SQL error, HELP!


  • Please log in to reply
5 replies to this topic

#1 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 28 September 2006 - 01:17 AM

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:

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


Here is the code to that page:
<? 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>

while($r=mysql_fetch_array($result)) <- Page 81

$indb = mysql_numrows(mysql_query("SELECT * FROM guestsubmit $getme")); <- Page 67

Can some one please help me out here?





#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 28 September 2006 - 02:09 AM

Try replacing this:

$indb = mysql_numrows(mysql_query("SELECT * FROM guestsubmit $getme"));

With this:

$query = "SELECT * from guestsubmit ". $getme;
$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); // what went wrong?
$indb = mysql_numrows($result);

Legend has it that reading the manual never killed anyone.
My site

#3 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 28 September 2006 - 02:51 AM

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


#4 Gaoshan

Gaoshan
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 28 September 2006 - 05:11 AM

The table you are trying to query simply doesn't exist.

#5 Benan

Benan
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 28 September 2006 - 08:01 PM

How do I fix it

#6 Gaoshan

Gaoshan
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 28 September 2006 - 08:12 PM

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: http://dev.mysql.com...1/en/index.html




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users