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

Thread Solved

Join Date: Jul 2009
Posts: 2
Reputation: salibaray is an unknown quantity at this point 
Solved Threads: 0
salibaray salibaray is offline Offline
Newbie Poster

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

 
1
  #1
Jul 4th, 2009
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 .

  1. <html>
  2. <?php flush(); ?>
  3. <body>
  4. <?php
  5. include_once("myDBCommunicator.php");
  6. $myClassLibrary = new myDBCommunicator();
  7. $myCasino = $_GET['myCasino'];
  8. $myLanguage = $_GET['myLanguage'];
  9. $myAdvert = $_GET['myAdvert'];
  10. $myAdvertType = $_GET['myAdvertType'];
  11. $myCurrency = "Euro";
  12. //$myUsername = $_GET['myUsername'];
  13. $myBannersTypeID = "";
  14. $myBlocked = "0";
  15. //$mySize = $_GET['myBannerSizeType'];
  16. $myCasinoLink = "";
  17. $myLanguageShort = "";
  18. $mySize = "";
  19. //Set Banner Type to DB name
  20. if ($myAdvert == 'Banners')
  21. {
  22. $myBannersTypeID = "bnrtypStatic";
  23. }else if($myAdvert == 'RotatingBanners')
  24. {
  25. $myBannersTypeID = "bnrtypRotating";
  26. }else
  27. {
  28. }
  29. //Set Casino to DB name
  30. if ($myCasino == 'Test1 Casino')
  31. {
  32. $myCasino = 'casTest1';
  33. $myCasinoLink = "test1.com";
  34. }else if($myCasino == 'Test2 Casino')
  35. {
  36. $myCasino = 'casTest2';
  37. $myCasinoLink = "test2.com";
  38. }else if($myCasino == 'Test3 Casino')
  39. {
  40. $myCasino = 'casTest3';
  41. $myCasinoLink = "test3.com";
  42. }else if($myCasino == 'Test4 ')
  43. {
  44. $myCasino = 'casTest4';
  45. $myCasinoLink = "test4.com";
  46. }else if($myCasino == 'Test5')
  47. {
  48. $myCasino = 'casTest5';
  49. $myCasinoLink = "test5.net";
  50. }else
  51. {
  52. }
  53. //Set Language to DB name
  54. if($myLanguage == 'English')
  55. {
  56. $myLanguageShort = 'en';
  57. }else if($myLanguage == 'French')
  58. {
  59. $myLanguageShort = 'fr';
  60. }else if($myLanguage == 'Italian')
  61. {
  62. $myLanguageShort = 'it';
  63. }else
  64. {
  65. }
  66. /*
  67. //Construct the Profile Name
  68. $currentProfileLetter = "s";
  69. $currentBannerSize = $myAdvertType;
  70. $singleLetterLanguage = "";
  71. $profileNumber = "a";
  72.  
  73. if($myLanguage == 'English')
  74. {
  75. $singleLetterLanguage = 'e';
  76. }else if($myLanguage == 'French')
  77. {
  78. $singleLetterLanguage = 'f';
  79. }else if($myLanguage == 'Italian')
  80. {
  81. $singleLetterLanguage = 'i';
  82. }else
  83. {
  84. }
  85. $myProfile = $currentProfileLetter.$currentBannerSize.$singleLetterLanguage.$profileNumber;
  86. echo $myProfile;
  87. */
  88.  
  89. /*
  90. //Get Profile
  91. $ProfileName = "";
  92. $myProfiles = $myClassLibrary->getProfileByDetails($myBannersTypeID, $myCasino, $myLanguage, $myCurrency);
  93. $ProfileName = "";
  94. $ProfileCounter = 0;
  95. while($myProfile = mysql_fetch_array($myProfiles)){
  96. $ProfileName = $myProfile['fProfileName'];
  97. $ProfileCounter++;
  98. }
  99. */
  100. ?>
  101. <?php $myHTMLCode = "<div id='phpContent'><ul>"; ?>
  102. <?php
  103. if ($myAdvert == 'Banners' || $myAdvert == 'RotatingBanners' || $myAdvert == 'FlashBanners')
  104. {
  105. $ProfileName = "";
  106. $mySize = $myAdvertType;
  107. $myProfiles = $myClassLibrary->getProfileByDetails($myBannersTypeID, $myCasino, $myLanguage, $myCurrency, $mySize) or die(mysql_error());
  108. $ProfileName = "";
  109. $ProfileCounter = 0;
  110. $myCount = 0;
  111. $myCount2 = 1000;
  112. $BannerType = "";
  113. while($myProfile = mysql_fetch_array($myProfiles, MYSQL_BOTH)){
  114. $ProfileName = $myProfile['fProfileName'];
  115. $ProfileCounter++;
  116. if ($myBannersTypeID == "bnrtypStatic")
  117. {
  118. $BannerType = "Static Banner";
  119. }else if ($myBannersTypeID == "bnrtypRotating")
  120. {
  121. $BannerType = "Rotating Banner";
  122. }else
  123. {
  124. }
  125. $myCount = $myCount + 1;
  126. $myCount2 = $myCount2 + 1;
  127. $BannerCount = $myCount;
  128. $myHTMLCode .= "<table border=0 ><tr>";
  129. $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>";
  130. $myHTMLCode .= "<b>Image Source: </b></br>";
  131. $myHTMLCode .= "</ br><textarea rows='3' cols='70' name='".$myCount."' id='".$myCount."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount.")' />$imageLink</textarea></ br>";
  132. $myHTMLCode .= "</br><b>Redirect Link: </b></br>";
  133. $myHTMLCode .= "</ br><textarea rows='3' cols='70' name='".$myCount2."' id='".$myCount2."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount2.")' />$redirectLink</textarea></ br>";
  134. $myHTMLCode .= "</td></tr><tr><td><p>&nbsp</p></td></tr></table>";
  135. }
  136. }else if ($myAdvert == 'Reviews')
  137. {
  138. if ($myAdvertType == 'LongReviews')
  139. {
  140. $myAdvertType = 'LongReview';
  141. //echo $myAdvertType;
  142. $myReviews = $myClassLibrary->getReviewByCasinoTypeAndLanguage($myCasino, $myAdvertType, $myLanguageShort, '0') or die(mysql_error());
  143. $myValue = count($myReviews);
  144. $myCount = 0;
  145. $ReviewContent = "";
  146. while($myReview = mysql_fetch_array($myReviews, MYSQL_BOTH)){
  147. $myCount++;
  148. $ReviewContent = $myReview['fContent'];
  149. $myHTMLCode .= "<table border=0 >";
  150. $myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray'><p><b>Review ".$myCount." :</b></p></td></tr>";
  151. $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>";
  152. $myHTMLCode .= "</table>";
  153. }
  154. }else if ($myAdvertType == 'ShortReviews')
  155. {
  156. $myAdvertType = 'ShortReview';
  157. $myReviews = $myClassLibrary->getReviewByCasinoTypeAndLanguage($myCasino, $myAdvertType, $myLanguageShort, '0') or die(mysql_error());
  158. $myValue = count($myReviews);
  159. $myCount = 0;
  160. $ReviewContent = "";
  161. while($myReview = mysql_fetch_array($myReviews, MYSQL_BOTH)){
  162. $ReviewContent = $myReview['fContent'];
  163. $myCount++;
  164. $myHTMLCode .= "<table border=0 >";
  165. $myHTMLCode .= "<tr><td valign='top' align='left' bgcolor='gray'><p><b>Review ".$myCount." :</b></p></tr>";
  166. $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>";
  167. $myHTMLCode .= "</table>";
  168. }
  169. }else
  170. {
  171. }
  172. }else if ($myAdvert == 'LandingPages')
  173. {
  174. echo $myAdvertType;
  175.  
  176. if ($myAdvertType == '')
  177. {
  178. }else if ($myAdvertType == '')
  179. {
  180. }else
  181. {
  182. }
  183. }else if ($myAdvert == 'Mailers')
  184. {
  185. if ($myAdvertType == '' || $myAdvertType == 'GeneralMailer' || $myAdvertType == 'HTMLMailers' || $myAdvertType == 'ImageMailers')
  186. {
  187. $myAdvertType = 'GeneralMailer';
  188. $myMailers = $myClassLibrary->getMailerByCasinoTypeAndLanguage($myCasino, $myLanguageShort, '0') or die(mysql_error());
  189. $myValue = count($myMailers);
  190. $myCount = 0;
  191. $MailerHTMLCode = "";
  192. $MailerThumbnailPath = "";
  193. $MailerFullPath = "";
  194. while($myMailer = mysql_fetch_array($myMailers, MYSQL_BOTH)){
  195. $MailerHTMLCode = $myMailer['fHTMLCode'];
  196. $MailerThumbnailPath = $myMailer['fThumbnailPicturePath'];
  197. $MailerFullPath = $myMailer['fMailerPath'];
  198. $myCount++;
  199. $myHTMLCode .= "<table border=0 ><tr>";
  200. $myHTMLCode .= "<td valign='top' align='left' bgcolor='gray' colspan='2'><p><b>Mailer ".$myCount." :</b></p></td></tr>";
  201. $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>";
  202. $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>";
  203. $myHTMLCode .= "<td><textarea rows='35' cols='66' name='".$myCount."' id='".$myCount."' wrap='virtual' readonly='yes' onmouseover='setFocus(".$myCount.")' />$MailerHTMLCode</textarea></td></tr>";
  204. $myHTMLCode .= "</tr><tr><td><p>&nbsp</p></td></tr></table>";
  205. }
  206. }else if ($myAdvertType == '')
  207. {
  208. }else
  209. {
  210. }
  211. }else
  212. {
  213. echo "Selected media is undergoing an update at the moment, please ty again later. Thank you.";
  214. }
  215. ?>
  216. <?php
  217. $myHTMLCode .= "</ul></div>";
  218. echo $myHTMLCode;
  219. ?>
  220. </body>
  221. </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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 463
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

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

 
0
  #2
Jul 4th, 2009
salibaray,

You have to read this post - http://www.daniweb.com/forums/thread191031.html
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 2
Reputation: salibaray is an unknown quantity at this point 
Solved Threads: 0
salibaray salibaray is offline Offline
Newbie Poster

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

 
0
  #3
Jul 4th, 2009
10x I solved it
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC