Hi there,

I'am developing a system for banner selection (affiliates) and I have tested the system throughly on my local machine and everything works just fine, but when I have uploaded it to my GoDaddy account and tried to use my system I got the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

btw these errors happen at lines 127, 198, 179 and 236. -> where 'mysql_fetch_array' appears.... hmmm.....

I dont know why this happens, I have read many forum threads and did alot of research but all I got was (spelling mistakes, case sensitive letters, commas, semicolons, table names, fetch query with fetch types, php includes, die error messages to see what the problem is, etc) -> I tried them all but still no luck :confused: .

<html>
<?php flush(); ?>
<body>
<?php
include_once("myDBCommunicator.php");
$myClassLibrary = new myDBCommunicator();
$myCasino		= $_GET['myCasino'];
$myLanguage		= $_GET['myLanguage'];
$myAdvert		= $_GET['myAdvert'];
$myAdvertType	= $_GET['myAdvertType'];
$myCurrency		= "Euro";
//$myUsername		= $_GET['myUsername'];
$myBannersTypeID	= "";
$myBlocked		= "0";
//$mySize	= $_GET['myBannerSizeType'];
$myCasinoLink	= "";
$myLanguageShort = "";
$mySize = "";
//Set Banner Type to DB name
if ($myAdvert == 'Banners')
{
	$myBannersTypeID	= "bnrtypStatic";
}else if($myAdvert == 'RotatingBanners')
{
	$myBannersTypeID	= "bnrtypRotating";
}else
{		
}
//Set Casino to DB name
if ($myCasino == 'Test1 Casino')
{
	$myCasino = 'casTest1';
	$myCasinoLink	= "test1.com";
}else if($myCasino == 'Test2 Casino')
{
	$myCasino = 'casTest2';
	$myCasinoLink	= "test2.com";
}else if($myCasino == 'Test3 Casino')
{
	$myCasino = 'casTest3';
	$myCasinoLink	= "test3.com";
}else if($myCasino == 'Test4 ')
{
	$myCasino = 'casTest4';
	$myCasinoLink	= "test4.com";
}else if($myCasino == 'Test5')
{
	$myCasino = 'casTest5';
	$myCasinoLink	= "test5.net";
}else
{
}
//Set Language to DB name
if($myLanguage == 'English')
{
	$myLanguageShort = 'en';
}else if($myLanguage == 'French')
{
	$myLanguageShort = 'fr';
}else if($myLanguage == 'Italian')
{
	$myLanguageShort = 'it';
}else
{
}
/*
//Construct the Profile Name
$currentProfileLetter = "s";
$currentBannerSize = $myAdvertType;
$singleLetterLanguage = "";
$profileNumber = "a";

if($myLanguage == 'English')
{
	$singleLetterLanguage = 'e';
}else if($myLanguage == 'French')
{
	$singleLetterLanguage = 'f';
}else if($myLanguage == 'Italian')
{
	$singleLetterLanguage = 'i';
}else
{
}
$myProfile = $currentProfileLetter.$currentBannerSize.$singleLetterLanguage.$profileNumber;
echo $myProfile;
*/

/*
//Get Profile
$ProfileName = "";
$myProfiles = $myClassLibrary->getProfileByDetails($myBannersTypeID, $myCasino, $myLanguage, $myCurrency);
	$ProfileName = "";
$ProfileCounter = 0;
while($myProfile = mysql_fetch_array($myProfiles)){
	$ProfileName = $myProfile['fProfileName'];
	$ProfileCounter++;	
}
*/
?>
<?php $myHTMLCode = "<div id='phpContent'><ul>"; ?>
<?php
if ($myAdvert == 'Banners' || $myAdvert == 'RotatingBanners' || $myAdvert == 'FlashBanners')
{
	$ProfileName = "";
	$mySize = $myAdvertType;
	$myProfiles = $myClassLibrary->getProfileByDetails($myBannersTypeID, $myCasino, $myLanguage, $myCurrency, $mySize) or die(mysql_error());
	$ProfileName = "";
	$ProfileCounter = 0;
	$myCount = 0;
	$myCount2 = 1000;
	$BannerType = "";
	while($myProfile = mysql_fetch_array($myProfiles, MYSQL_BOTH)){
	$ProfileName = $myProfile['fProfileName'];
	$ProfileCounter++;
	if ($myBannersTypeID == "bnrtypStatic")
	{
		$BannerType = "Static Banner";
	}else if ($myBannersTypeID == "bnrtypRotating")
	{
		$BannerType = "Rotating Banner";
	}else
	{		
	}
		$myCount = $myCount + 1;
		$myCount2 = $myCount2 + 1;
		$BannerCount = $myCount;
		$myHTMLCode .= "<table border=0 ><tr>";
		$myHTMLCode .= "<td valign='top' align='left' bgcolor='gray'><p><b>".$BannerType." ".$BannerCount."</b></p></br><center><img src='".$imageLink."' title='".$BannerType." ".$BannerCount."' alt='".$BannerType."' /></center></br></a>";
		$myHTMLCode .= "<b>Image Source: </b></br>";
		$myHTMLCode .= "</ br><textarea rows='3' cols='70' name='".$myCount."' id='".$myCount."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount.")' />$imageLink</textarea></ br>";
		$myHTMLCode .= "</br><b>Redirect Link: </b></br>";
		$myHTMLCode .= "</ br><textarea rows='3' cols='70' name='".$myCount2."' id='".$myCount2."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount2.")' />$redirectLink</textarea></ br>";
		$myHTMLCode .= "</td></tr><tr><td><p>&nbsp</p></td></tr></table>";	
	}
}else if ($myAdvert == 'Reviews')
	{
		if ($myAdvertType == 'LongReviews')
		{
			$myAdvertType = 'LongReview';
			//echo $myAdvertType;
			$myReviews = $myClassLibrary->getReviewByCasinoTypeAndLanguage($myCasino, $myAdvertType, $myLanguageShort, '0') or die(mysql_error());
			$myValue = count($myReviews);
			$myCount = 0;
			$ReviewContent = "";
			while($myReview = mysql_fetch_array($myReviews, MYSQL_BOTH)){
				$myCount++;
				$ReviewContent = $myReview['fContent'];
				$myHTMLCode .= "<table border=0 >";
				$myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray'><p><b>Review ".$myCount." :</b></p></td></tr>";
				$myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray'><textarea rows='50' cols='80' name='".$myCount."' id='".$myCount."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount.")' />$ReviewContent</textarea></td></tr>";
				$myHTMLCode .= "</table>";
			}
		}else if ($myAdvertType == 'ShortReviews')
		{
			$myAdvertType = 'ShortReview';
			$myReviews = $myClassLibrary->getReviewByCasinoTypeAndLanguage($myCasino, $myAdvertType, $myLanguageShort, '0') or die(mysql_error());
			$myValue = count($myReviews);
			$myCount = 0;
			$ReviewContent = "";
				while($myReview = mysql_fetch_array($myReviews, MYSQL_BOTH)){
				$ReviewContent = $myReview['fContent'];
				$myCount++;
				$myHTMLCode .= "<table border=0 >";
					$myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray'><p><b>Review ".$myCount." :</b></p></tr>";
					$myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray'><textarea rows='35' cols='80' name='".$myCount."' id='".$myCount."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount.")' />$ReviewContent</textarea></td></tr>";
					$myHTMLCode .= "</table>";
			}
		}else
		{			
		}
	}else if  ($myAdvert == 'LandingPages')
	{
		echo $myAdvertType;
			
		if ($myAdvertType == '')
		{	
		}else if ($myAdvertType == '')
		{			
		}else
		{			
		}	
	}else if  ($myAdvert == 'Mailers')
	{		
		if ($myAdvertType == '' || $myAdvertType == 'GeneralMailer' || $myAdvertType == 'HTMLMailers' || $myAdvertType == 'ImageMailers')
		{
			$myAdvertType = 'GeneralMailer';
			$myMailers = $myClassLibrary->getMailerByCasinoTypeAndLanguage($myCasino, $myLanguageShort, '0') or die(mysql_error());
			$myValue = count($myMailers);
			$myCount = 0;
			$MailerHTMLCode = "";
			$MailerThumbnailPath = "";
			$MailerFullPath = "";
					while($myMailer = mysql_fetch_array($myMailers, MYSQL_BOTH)){
						$MailerHTMLCode = $myMailer['fHTMLCode'];
						$MailerThumbnailPath = $myMailer['fThumbnailPicturePath'];
						$MailerFullPath = $myMailer['fMailerPath'];
						$myCount++;
						$myHTMLCode .= "<table border=0 ><tr>";
						$myHTMLCode .= "<td valign='top' align='left' bgcolor='gray' colspan='2'><p><b>Mailer ".$myCount." :</b></p></td></tr>";
						$myHTMLCode .= "<td valign='bottom' align='left' bgcolor='gray' colspan='1'><p><b>Mailer Preview</b></p></td><td valign='bottom' align='left' bgcolor='gray' colspan='1'><p><b>Mailer HTML</b></p></td></tr>";
						$myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray' colspan='1'><center><img src='" . $myMailer['fThumbnailPicturePath'] . "' title='". $myMailer['fTitle']."' alt='". $myMailer['fTitle']."' width='150' height='200' /></ br><a href=\'.$MailerFullPath.'> Download mailer as an image </a></center></td>";
						$myHTMLCode .= "<td><textarea rows='35' cols='66' name='".$myCount."' id='".$myCount."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount.")' />$MailerHTMLCode</textarea></td></tr>";
						$myHTMLCode .= "</tr><tr><td><p>&nbsp</p></td></tr></table>";
					}
		}else if ($myAdvertType == '')
		{				
		}else
		{				
		}
	}else
	{
		echo "Selected media is undergoing an update at the moment, please ty again later. Thank you.";
	}
?>
<?php
$myHTMLCode .= "</ul></div>";
echo $myHTMLCode;
?>
</body>
</html>

* Why does this problem occur ?
* How can I solve it lol ?
* and how can I prevent it ?

Please help me cause Im really frustrated by this problem, Im a newbie php programmer and willing to learn.

10x ppl

kvprajapati commented: First post with code tags - Very good. +5

10x I solved it :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.