add an... or die(mysql_error()) to the $resultm = mysql_query($sqlm);
statement and you'll have a lot more info for yourself,  and the list if
you still need assistance.




                                                                                       
                             
                    "MET"                                                              
                             
                    <met@uberstats       To:     <[EMAIL PROTECTED]>                
                             
                    .com>                cc:                                           
                             
                                         Subject:     [PHP-DB] Supplied argument is 
not a valid MySQL result        
                    08/09/2002            resource                                     
                             
                    11:46 AM                                                           
                             
                                                                                       
                             
                                                                                       
                             




I'm getting some massive errors on some pretty simple code.  Included
are the errors as well as the PHP function that is giving me issues.
Any help would be greatly appreciated.  And the weirdest thing, is that
the code used to work.... ??

Line 267 is equal to this PHP line:

 $RSM = mysql_fetch_array($resultm);

=============================
ERRORS:
=============================

Warning: Supplied argument is not a valid MySQL result resource in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 267

Warning: Supplied argument is not a valid MySQL result resource in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 269

Warning: Supplied argument is not a valid MySQL result resource in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 287

Warning: Supplied argument is not a valid MySQL result resource in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 289

Warning: Supplied argument is not a valid MySQL result resource in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 295

Warning: Supplied argument is not a valid MySQL result resource in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 297 less than one inside
of nothing found.
Warning: Undefined index: format in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 327

Warning: Undefined index: bannerID in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333

Warning: Undefined index: bannerID in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333

Warning: Undefined index: width in D:\Gunks\NewSite\phpAds\view.inc.php3
on line 333

Warning: Undefined index: height in
D:\Gunks\NewSite\phpAds\view.inc.php3 on line 333

Warning: Undefined index: alt in D:\Gunks\NewSite\phpAds\view.inc.php3
on line 333

=============================
CODE:
=============================

function view_order($keywords, $id)
{
   global $phpAds_db, $phpAds_hostname, $phpAds_mysqluser,
$phpAds_mysqlpassword, $REMOTE_HOST, $USER, $phpAds_tbl_banners;

 if(!isset($USER[$id]["cbannerID"])) $USER[$id]["cbannerID"] =
-1;

 #############################################################

 $text = explode("/", $keywords);

 $keywords = "";

 $x = 0;

 foreach($text as $line)
 {
  if( $x == 0 )
  {
   $keywords = "(keyword LIKE '%" . $line . "%'";
  }
  else
  {
   $keywords = $keywords . " OR keyword LIKE '%" .
$line . "%'";
  }

  $x++;
 }

 $keywords .= ")";

 #############################################################


mysql_connect($phpAds_hostname,$phpAds_mysqluser,$phpAds_mysqlpassword)
or die("Unable to connect to database");
 @mysql_select_db("$phpAds_db") or die("Unable to select database
$phpAds_db");

 if($USER[$id]["cbannerID"] == -1)
 {
  $sqlm = "SELECT MIN(bannerID), MAX(bannerID) FROM
banners WHERE active='true';";

  $resultm = mysql_query($sqlm);

  $RSM = mysql_fetch_array($resultm);

  if( mysql_num_rows($resultm) < 1 )
  {
   $num1 = rand(1, 100);
  }
  Else
  {
   $num1 = rand($RSM[0], $RSM[1]);
  }

  $sql = "SELECT
bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners
WHERE active = 'true' AND $keywords AND bannerID >= $num1 ORDER BY
bannerID LIMIT 0,1;";
 }
 else
 {
  $sql = "SELECT
bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners
WHERE active = 'true' AND $keywords AND bannerID > " .
$USER[$id]["cbannerID"] . " ORDER BY bannerID LIMIT 0,1;";
 }

 $result = mysql_query($sql);

 $RS = mysql_fetch_array($result);

 if( mysql_num_rows($result) < 1 )
 {
  $sql2 = "SELECT
bannerID,banner,format,width,height,alt,url FROM $phpAds_tbl_banners
WHERE active = 'true' AND $keywords ORDER BY bannerID LIMIT 0,1;";

  $result2 = mysql_query($sql2);

  $RS2 = mysql_fetch_array($result2);

  if( mysql_num_rows($result2) < 1 )
  {
   echo "less than one inside of nothing found.";
  }
  Else
  {
   $USER[$id]["bannerID"] = $RS2["bannerID"];
   $USER[$id]["banner"] = $RS2["banner"];
   $USER[$id]["format"] = $RS2["format"];
   $USER[$id]["width"] = $RS2["width"];
   $USER[$id]["height"] = $RS2["height"];
   $USER[$id]["alt"] = $RS2["alt"];
   $USER[$id]["url"] = $RS2["url"];

   $USER[$id]["cbannerID"] = $RS2["bannerID"];
  }
 }
 Else
 {
  $USER[$id]["bannerID"] = $RS["bannerID"];
  $USER[$id]["banner"] = $RS["banner"];
  $USER[$id]["format"] = $RS["format"];
  $USER[$id]["width"] = $RS["width"];
  $USER[$id]["height"] = $RS["height"];
  $USER[$id]["alt"] = $RS["alt"];
  $USER[$id]["url"] = $RS["url"];

  $USER[$id]["cbannerID"] = $RS["bannerID"];
 }

 if($USER[$id]["format"] == "html")
 {
  echo "<center><a
href=\"$GLOBALS[phpAds_url_prefix]/click.php3?bannerID=" .
$USER[$id]["bannerID"] . "\" target=\"_blank\">" . $USER[$id]["banner"]
. "</a></center>";
 }
 else
 {
  echo "<a
href=\"$GLOBALS[phpAds_url_prefix]/click.php3?bannerID=" .
$USER[$id]["bannerID"] . "\" target=\"_blank\"><img
src=\"$GLOBALS[phpAds_url_prefix]/viewbanner.php3?bannerID=" .
$USER[$id]["bannerID"] . "\" width=" . $USER[$id]["width"] . " height="
. $USER[$id]["height"] . " alt=\"" . $USER[$id]["alt"] . "\"
border=0></a>";
 }

 //log_adview($USER[$id]["bannerID"]);
}

(See attached file: the_code.txt)
(See attached file: errors.txt)
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to