Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 2002 11:50:47 -0400
From:      "MET" <met@uberstats.com>
To:        <freebsd-questions@FreeBSD.ORG>
Subject:   Off the Main Topic || Supplied argument is not a valid MySQL result resource
Message-ID:  <001801c23fbc$879e5f60$6701a8c0@SURVIVAL>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

------=_NextPart_000_0019_01C23F9B.008CBF60
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I realize that this is off topic, but I'm sending it to more specific
PHP lists as well but none of them have such helpful people on them.

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

------=_NextPart_000_0019_01C23F9B.008CBF60
Content-Type: text/plain;
	name="the_code.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="the_code.txt"

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"] =3D -1;
=09
	#############################################################

	$text =3D explode("/", $keywords);
=09
	$keywords =3D "";
=09
	$x =3D 0;
=09
	foreach($text as $line)
	{
		if( $x =3D=3D 0 )
		{=09
			$keywords =3D "(keyword LIKE '%" . $line . "%'";
		}
		else
		{
			$keywords =3D $keywords . " OR keyword LIKE '%" . $line . "%'";
		}
	=09
		$x++;
	}
=09
	$keywords .=3D ")";
=09
	#############################################################
=09
	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");
=09
	if($USER[$id]["cbannerID"] =3D=3D -1)
	{
		$sqlm =3D "SELECT MIN(bannerID), MAX(bannerID) FROM banners WHERE =
active=3D'true';";
	=09
		$resultm =3D mysql_query($sqlm);
		=09
		$RSM =3D mysql_fetch_array($resultm);

		if( mysql_num_rows($resultm) < 1 )
		{
			$num1 =3D rand(1, 100);
		}
		Else
		{
			$num1 =3D rand($RSM[0], $RSM[1]);
		}
	=09
		$sql =3D "SELECT bannerID,banner,format,width,height,alt,url FROM =
$phpAds_tbl_banners WHERE active =3D 'true' AND $keywords AND bannerID =
>=3D $num1 ORDER BY bannerID LIMIT 0,1;";
	}
	else
	{
		$sql =3D "SELECT bannerID,banner,format,width,height,alt,url FROM =
$phpAds_tbl_banners WHERE active =3D 'true' AND $keywords AND bannerID > =
" . $USER[$id]["cbannerID"] . " ORDER BY bannerID LIMIT 0,1;";
	}
=09
	$result =3D mysql_query($sql);
		=09
	$RS =3D mysql_fetch_array($result);

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

		$result2 =3D mysql_query($sql2);
		=09
		$RS2 =3D mysql_fetch_array($result2);

		if( mysql_num_rows($result2) < 1 )
		{
			echo "less than one inside of nothing found.";
		}
		Else
		{
			$USER[$id]["bannerID"] =3D $RS2["bannerID"];
			$USER[$id]["banner"] =3D $RS2["banner"];
			$USER[$id]["format"] =3D $RS2["format"];
			$USER[$id]["width"] =3D $RS2["width"];
			$USER[$id]["height"] =3D $RS2["height"];
			$USER[$id]["alt"] =3D $RS2["alt"];
			$USER[$id]["url"] =3D $RS2["url"];
	=09
			$USER[$id]["cbannerID"] =3D $RS2["bannerID"];
		}
	}
	Else
	{
		$USER[$id]["bannerID"] =3D $RS["bannerID"];
		$USER[$id]["banner"] =3D $RS["banner"];
		$USER[$id]["format"] =3D $RS["format"];
		$USER[$id]["width"] =3D $RS["width"];
		$USER[$id]["height"] =3D $RS["height"];
		$USER[$id]["alt"] =3D $RS["alt"];
		$USER[$id]["url"] =3D $RS["url"];
	=09
		$USER[$id]["cbannerID"] =3D $RS["bannerID"];
	}
=09
	if($USER[$id]["format"] =3D=3D "html")
	{
		echo "<center><a =
href=3D\"$GLOBALS[phpAds_url_prefix]/click.php3?bannerID=3D" . =
$USER[$id]["bannerID"] . "\" target=3D\"_blank\">" . =
$USER[$id]["banner"] . "</a></center>";
	}
	else
	{
		echo "<a href=3D\"$GLOBALS[phpAds_url_prefix]/click.php3?bannerID=3D" =
. $USER[$id]["bannerID"] . "\" target=3D\"_blank\"><img =
src=3D\"$GLOBALS[phpAds_url_prefix]/viewbanner.php3?bannerID=3D" . =
$USER[$id]["bannerID"] . "\" width=3D" . $USER[$id]["width"] . " =
height=3D" . $USER[$id]["height"] . " alt=3D\"" . $USER[$id]["alt"] . =
"\" border=3D0></a>";
	}
   =20
	//log_adview($USER[$id]["bannerID"]);
}
------=_NextPart_000_0019_01C23F9B.008CBF60
Content-Type: text/plain;
	name="errors.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="errors.txt"

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
------=_NextPart_000_0019_01C23F9B.008CBF60--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001801c23fbc$879e5f60$6701a8c0>