470,831 Members | 1,313 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,831 developers. It's quick & easy.

Having problems with my download script

I got a few errors with this script

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line 15

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line 70

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/starfi3ld/domains/starfi3ld.com/public_html/newreleases.php on line 73

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. include("header.php");
  4.  
  5. define('IN_PHPBB', true);
  6. $phpbb_root_path = 'Forum/';
  7. include($phpbb_root_path . 'extension.inc');
  8. include($phpbb_root_path . 'common.'.$phpEx);
  9. $userdata = session_pagestart($user_ip, PAGE_INDEX);
  10. init_userprefs($userdata);
  11.  
  12. if ($userdata['session_user_id'] != "") {
  13.     $qry = "select access_level from list_users where user_id=".$userdata['session_user_id'];
  14.     $result = mysql_query($qry,$dbi);
  15.     if (mysql_num_rows($result) > 0) {
  16.         list($acclvl) = mysql_fetch_row($result);
  17.         $path = "/donators";
  18.     } else {
  19.         $acclvl = "1";
  20.         $path = "/users";
  21.     }
  22. } else {
  23.     $acclvl = "1";
  24.     $path = "/users";
  25. }
  26.  
  27. if ($_GET['mode'] == "list") {
  28.     $qry = "select distinct date(file_date) from list_anime where access_level<=$acclvl order by file_date desc";
  29.     $result = mysql_query($qry,$dbi);
  30.     $numrows = mysql_num_rows($result);
  31.     echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"
  32.         ."<tr><td></td></tr>\n";
  33.     for ($i=0;$i<$numrows;$i++) {
  34.         list($lstdate) = mysql_fetch_row($result);
  35.         $lstdatecust = dateconvert($lstdate);
  36.         echo "<tr><td nowrap>"
  37.             ."<strong>:&middot;</strong>&nbsp;<a href=\"newreleases.php?mode=date&amp;datepick=".substr($lstdate,0,12)."\">".substr($lstdatecust,0,12)."</a>"
  38.             ."</td></tr>\n";
  39.     }
  40.     echo "</table>\n";
  41. } elseif ($_GET['mode'] == "date") {
  42.     $datepick = $_GET['datepick'];
  43.     $qry = "select id,file_name,server,location from list_anime where access_level<=$acclvl and file_date like '$datepick%' order by file_name asc";
  44.     $result = mysql_query($qry,$dbi);
  45.     $numrows = mysql_num_rows($result);
  46.     $datepick = dateconvert($datepick);
  47.     if ($numrows != 0) {
  48.         echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"
  49.             ."<tr><td style=\"border-bottom-style:inset; border-bottom-width:thin; border-top-color:#FFFFFF\">".substr($datepick,0,12)."</td></tr>\n"
  50.             ."<tr><td></td></tr>\n";
  51.         for ($i=0;$i<$numrows;$i++) {
  52.             list($id,$file,$svr,$loc) = mysql_fetch_row($result);
  53.             if (eregi("backup",$loc)) {
  54.                 $mdir = "anime2";
  55.             } else {
  56.                 $mdir = "anime";
  57.             }
  58.             $lnk = base64_encode($file."|".$loc."|".$mdir);
  59.             echo "<tr><td nowrap>"
  60.                 ."<strong>:&middot;</strong>&nbsp;<a href=\"".$svr.$path."/getfile.php?fileid=$id&amp;lnk=$lnk\">$file</a>"
  61.                 ."</td></tr>\n";
  62.         }
  63.         echo "</table>\n";
  64.     }
  65.     echo "<br><br>\n<div align=\"right\"><a href=\"newreleases.php?mode=list\">Archives</a></div>\n";
  66. } else {
  67.     //list file based on latest entry date
  68.     $qry = "select file_date from list_anime where access_level<=$acclvl order by file_date desc";
  69.     $result = mysql_query($qry,$dbi);
  70. [/b]    list($latestdt) = mysql_fetch_row($result);
  71.     $qry = "select id,file_name,server,location from list_anime where access_level<=$acclvl and file_date like '".substr($latestdt,0,10)."%' order by file_name asc";
  72.     $result = mysql_query($qry,$dbi);
  73.     [b]$numrows = mysql_num_rows($result);
  74.     $latestdt = dateconvert($latestdt);
  75.     if ($numrows != 0) {
  76.         echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">\n"
  77.             ."<tr><td style=\"border-bottom-style:inset; border-bottom-width:thin; border-top-color:#FFFFFF\">Last update: $latestdt</td></tr>\n"
  78.             ."<tr><td></td></tr>\n";
  79.         for ($i=0;$i<$numrows;$i++) {
  80.             list($id,$file,$svr,$loc) = mysql_fetch_row($result);
  81.             if (eregi("backup",$loc)) {
  82.                 $mdir = "anime2";
  83.             } else {
  84.                 $mdir = "anime";
  85.             }
  86.             $lnk = base64_encode($file."|".$loc."|".$mdir);
  87.             echo "<tr><td nowrap>"
  88.                 ."<strong>:&middot;</strong>&nbsp;<a href=\"".$svr.$path."/getfile.php?fileid=$id&amp;lnk=$lnk\">$file</a>"
  89.                 ."</td></tr>\n";
  90.         }
  91.         echo "</table>\n";
  92.     }
  93.     echo "<br><br>\n<div align=\"right\"><a href=\"newreleases.php?mode=list\">Archives</a></div>\n";
  94. }
  95.  
  96. include("footer.php");
  97.  
  98. ?>
Can anyone help me with this? This is a new releases script connected to my downloads database... It is supposed to show the latest file entries and keep an archive of it... I'm not sure what i did wrong.... i'm using
Mysql Server version: 4.1.21-standard
and also Direct admin as my server CP
Apr 14 '07 #1
2 1667
erm adding to that, The scripts used to work until i transferred the site unto another server... So I'm quite confused now..

Line 15 is in bold

If you cant find line 70 and 73, search for
list($latestdt) = mysql_fetch_row($result); - Line 70

$numrows = mysql_num_rows($result); - Line 73
Apr 14 '07 #2
Motoma
3,237 Expert 2GB
You never called mysql_connect() to establish your database connection.
Apr 15 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Martin | last post: by
2 posts views Thread by Jan Paul van de Berg | last post: by
9 posts views Thread by Tuy Solang | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.