473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

need help with php code on this site

am currently woking on building this site: www.maverick-spirit.com.
everything seems to be fine except the press releases page. When you
click on one of the press releases in the left column under the menu,
nothing comes up. I copied the code for the page directly from the
press releases page on our main site: www.maverickentertainment.cc, and
it is using an identical database, so I am unsure what is wrong.

The issue happens when you click one of the press releases in the left
column. The pressdetail.php page should open up with the text of the
press release. Instead, it is just blank. Then, when you click "Press
Releases", it should go to the page press.php. The following error
occurs when trying to access press.php: "Warning: mysql_fetch_assoc():
11 is not a valid MySQL result resource in
/home/mavetcom/public_html/press.php on line 80"

This is the line in question:

<?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>

Here is the PHP code for pressdetail.php:

Expand|Select|Wrap|Line Numbers
  1. <?php require('Connections/connDatabase.php'); ?>
  2.  
  3. <?php
  4. $colname_rsNews = "1";
  5. if (isset($HTTP_GET_VARS['NewsID'])) {
  6. $colname_rsNews = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['NewsID']
  7. : addslashes($HTTP_GET_VARS['NewsID']);
  8. }
  9. mysql_select_db($database_connDatabase, $connDatabase);
  10. $query_rsNews = sprintf("SELECT NewsID, NewsName, NewsDate, NewsShort,
  11. NewsFull FROM News", $colname_rsNews);
  12. $rsNews = mysql_query($query_rsNews, $connDatabase) or
  13. die(mysql_error());
  14. $row_rsNews = mysql_fetch_assoc($rsNews);
  15. $totalRows_rsNews = mysql_num_rows($rsNews);
  16. require('includes/configure.php'); ?>
  17. <html><!-- InstanceBegin template="/Templates/pagelayout2003.dwt.php"
  18. codeOutsideHTMLIsLocked="false" -->
  19. <head>
  20. <!-- InstanceBeginEditable name="doctitle" -->
  21. <title><?php echo substr($row_rsNews['NewsShort'], 0, 50);
  22. ?>...</title>
  23. <meta name="description" content="<?php echo $row_rsNews['NewsShort'];
  24. ?>">
  25. <!-- InstanceEndEditable -->
  26. <meta http-equiv="Content-Type" content="text/html;
  27. charset=iso-8859-1">
  28. <meta name="keywords" content="Maverick Entertainment, Maverick Home
  29. Video, Doug Schwab, Urban Film Distribution, Urban Film Production,
  30. Urban Films, Urban Movies, gangsta movies, a miami tail, african
  31. american movies, Afro-American Movies, American Black Film Festival,
  32. black african american movies, Black Cinema, black film festivals,
  33. Black Films, Blockbuster Distribution, blockbuster video, dvd movies,
  34. eva longoria, film distribution, film makers, film production
  35. companies, hip hop movies, hollywood black film festival, independent
  36. film festivals, independent film production, independent films, latino
  37. actresses, latino movies, Maverick Pictures, movie production
  38. companies, rapper trina, Rappers in Movies, trina the rapper">
  39. <link href="styles.css" rel="stylesheet" type="text/css">
  40. <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable
  41. --><!-- InstanceParam name="onload" type="text" value="" -->
  42. </head>
  43. <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  44. <table width="100%"  border="0" cellpadding="0" cellspacing="0"
  45. background="../images/headerbg.jpg" style="border-bottom:1px solid
  46. #cccccc;">
  47. <tr>
  48. <td height="75">&nbsp;</td>
  49.  
  50. <td width="580" height="75" align="right" valign="bottom"><img
  51. src="../images/division.gif" width="273" height="20"
  52. style="margin-bottom:5px; margin-right:10px;"></td>
  53. <td height="75">&nbsp;</td>
  54. </tr>
  55. </table>
  56. <table width="100%">
  57. <tr>
  58. <td height="100">&nbsp;</td>
  59.  
  60. <td width="5000" height="100" align="center" valign="middle"><div
  61. style="position:relative;top:7px"><img src="../images/spirit.jpg"
  62. width="760" height="100" class="pictureframe"></td>
  63. <td height="100">&nbsp;</td>
  64. </tr>
  65. </table>
  66. <table width="760"  border="0" align="center" cellpadding="0"
  67. cellspacing="0" style="margin-top:15px;">
  68. <tr align="left" valign="top">
  69. <td width="180">
  70. <?php include(DIR_INCLUDES . 'leftcol.php'); ?>
  71. <!-- InstanceBeginEditable name="leftcol" --><!-- InstanceEndEditable
  72. --></td>
  73. <td width="10"><img src="../images/spacer.gif" width="10"
  74. height="10"></td>
  75. <td class="contentarea"><!-- InstanceBeginEditable name="content"
  76. -->
  77. <h1><img src="images/spiritpress.jpg" alt="" height="81"
  78. width="536" border="0"></h1>
  79. <table width="380" border="0" cellspacing="4" cellpadding="0"
  80. align="center">
  81. <tr>
  82. <td valign="top">&nbsp;</td>
  83. </tr>
  84. <tr>
  85. <td valign="top"><a href="../press.php">&laquo; Press
  86. Releases</a></td>
  87. </tr>
  88. <tr>
  89. <td class="bodystandard" valign="top">&nbsp;</td>
  90. </tr>
  91. <tr>
  92. <td class="bodystandard" valign="top"><?php echo
  93. $row_rsNews['NewsFull']; ?></td>
  94. </tr>
  95. <tr>
  96. <td valign="top"><img src="../images/spacer10x10.gif"
  97. height="18" width="100%"></td>
  98. </tr>
  99. </table>
  100. <div>
  101. <em><font
  102. color="#996699"></font></em></div>                        </td></tr></tbody></td></tr></tbody></table>
  103. <table class="bottomtable" cellspacing="0" cellpadding="5" width="650"
  104. align="center" bgcolor="#ffffff" border="0">
  105. <tbody>
  106. <tr>
  107. <td valign="top" align="center">
  108.  
  109.  
  110. <p align="center" class="footer">
  111. <?php include(DIR_INCLUDES . 'footer.php'); ?>
  112. </p>
  113. </body>
  114. <!-- InstanceEnd --></html>

and the code for press.php:

Expand|Select|Wrap|Line Numbers
  1. <?php require_once('Connections/connDatabase.php'); ?>
  2. <?php require('includes/configure.php'); ?>
  3. <?php
  4. mysql_select_db($database_connDatabase, $connDatabase);
  5. $query_rsNews = "SELECT SQL_CACHE NewsCategory, NewsID, NewsName,
  6. NewsDate, NewsShort, NewsActive FROM News WHERE NewsCategory = 1 AND
  7. NewsActive = 'Yes' ORDER BY NewsDate DESC LIMIT 5";
  8. $rsNews = mysql_query($query_rsNews, $connDatabase) or
  9. die(mysql_error());
  10. $row_rsNews = mysql_fetch_assoc($rsNews);
  11. $totalRows_rsNews = mysql_num_rows($rsNews);
  12.  
  13. mysql_select_db($database_connDatabase, $connDatabase);
  14. $query_rsPressReleases = "SELECT SQL_CACHE NewsCategory, NewsID,
  15. NewsDate, NewsShort, NewsActive FROM News WHERE NewsCategory = 2 AND
  16. NewsActive = 'Yes' ORDER BY NewsDate DESC LIMIT 5";
  17. $rsPressReleases = mysql_query($query_rsPressReleases, $connDatabase)
  18. or die(mysql_error());
  19. $row_rsPressReleases = mysql_fetch_assoc($rsPressReleases);
  20. $totalRows_rsPressReleases = mysql_num_rows($rsPressReleases);
  21.  
  22. mysql_select_db($database_connDatabase, $connDatabase);
  23. $query_rsAdvisories = "SELECT SQL_CACHE NewsCategory, NewsID, NewsDate,
  24. NewsShort, NewsActive FROM News WHERE NewsCategory = 3 AND NewsActive =
  25. 'Yes' ORDER BY NewsDate DESC LIMIT 5";
  26. $rsAdvisories = mysql_query($query_rsAdvisories, $connDatabase) or
  27. die(mysql_error());
  28. $row_rsAdvisories = mysql_fetch_assoc($rsAdvisories);
  29. $totalRows_rsAdvisories = mysql_num_rows($rsAdvisories);
  30. ?>
  31. <html><!-- InstanceBegin template="/Templates/pagelayout2003.dwt.php"
  32. codeOutsideHTMLIsLocked="false" -->
  33. <head>
  34. <!-- InstanceBeginEditable name="doctitle" -->
  35. <title><?php echo substr($row_rsNews['NewsShort'], 0, 50);
  36. ?>...</title>
  37. <meta name="description" content="<?php echo $row_rsNews['NewsShort'];
  38. ?>">
  39. <!-- InstanceEndEditable -->
  40. <meta http-equiv="Content-Type" content="text/html;
  41. charset=iso-8859-1">
  42. <meta name="keywords" content="Maverick Entertainment, Maverick Home
  43. Video, Doug Schwab, Urban Film Distribution, Urban Film Production,
  44. Urban Films, Urban Movies, gangsta movies, a miami tail, african
  45. american movies, Afro-American Movies, American Black Film Festival,
  46. black african american movies, Black Cinema, black film festivals,
  47. Black Films, Blockbuster Distribution, blockbuster video, dvd movies,
  48. eva longoria, film distribution, film makers, film production
  49. companies, hip hop movies, hollywood black film festival, independent
  50. film festivals, independent film production, independent films, latino
  51. actresses, latino movies, Maverick Pictures, movie production
  52. companies, rapper trina, Rappers in Movies, trina the rapper">
  53. <link href="styles.css" rel="stylesheet" type="text/css">
  54. <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable
  55. --><!-- InstanceParam name="onload" type="text" value="" -->
  56. </head>
  57. <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  58. <table width="100%"  border="0" cellpadding="0" cellspacing="0"
  59. background="../images/headerbg.jpg" style="border-bottom:1px solid
  60. #cccccc;">
  61. <tr>
  62. <td height="75">&nbsp;</td>
  63.  
  64. <td width="580" height="75" align="right" valign="bottom"><img
  65. src="../images/division.gif" width="273" height="20"
  66. style="margin-bottom:5px; margin-right:10px;"></td>
  67. <td height="75">&nbsp;</td>
  68. </tr>
  69. </table>
  70. <table width="100%">
  71. <tr>
  72. <td height="100">&nbsp;</td>
  73.  
  74. <td width="5000" height="100" align="center" valign="middle"><div
  75. style="position:relative;top:7px"><img src="../images/spirit.jpg"
  76. width="760" height="100" class="pictureframe"></td>
  77. <td height="100">&nbsp;</td>
  78. </tr>
  79. </table>
  80. <table width="760"  border="0" align="center" cellpadding="0"
  81. cellspacing="0" style="margin-top:15px;">
  82. <tr align="left" valign="top">
  83. <td width="180">
  84. <?php include(DIR_INCLUDES . 'leftcol.php'); ?>
  85. <!-- InstanceBeginEditable name="leftcol" --><!-- InstanceEndEditable
  86. --></td>
  87. <td width="10"><img src="../images/spacer.gif" width="10"
  88. height="10"></td>
  89. <td class="contentarea"><!-- InstanceBeginEditable name="content"
  90. -->
  91. <h1><img src="images/spiritpress.jpg" alt="" height="81"
  92. width="536" border="0"></h1>
  93. <table width="380" border="0" align="center" cellpadding="0"
  94. cellspacing="4">
  95. <tr>
  96. <td valign="top"</td>
  97. </tr>
  98. <?php if ($totalRows_rsNews 0) { // Show if recordset not
  99. empty ?>
  100. <tr>
  101. <td valign="top" class="bodybold">In The News <span
  102. class="bodysmall">[ <a href="press_archive.php?NewsCategoryID=1">View
  103. Archive for more stories</a]</span></td>
  104. </tr>
  105. <tr>
  106. <td valign="top" class="bodybold"</td>
  107. </tr>
  108. <tr>
  109. <td valign="top">
  110. <table width="100%" border="0" cellspacing="0"
  111. cellpadding="0">
  112. <?php do { ?>
  113. <tr align="left" valign="baseline">
  114. <td width="80" valign="top"><img src="images/icon_doc.gif"
  115. width="10" height="10"<?php echo DoDateTime( $row_rsNews['NewsDate'],
  116. 'm/d/y'); ?:</td>
  117. <td valign="top"><a href="pressdetail.php?NewsID=<?php echo
  118. $row_rsNews['NewsID']; ?>"><?php echo $row_rsNews['NewsShort']; ?>
  119. ....</a></td>
  120. </tr>
  121. <tr align="left" valign="baseline">
  122. <td height="10" colspan="2" valign="top"><img
  123. src="images/spacer10x10.gif" width="10" height="10"></td>
  124. </tr>
  125. <?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>
  126. </table>
  127. </td>
  128. </tr>
  129. <?php } // Show if recordset not empty ?><?php if
  130. ($totalRows_rsPressReleases 0) { // Show if recordset not empty ?>
  131. <tr>
  132. <td valign="top" class="bodybold"</td>
  133. </tr>
  134. <tr>
  135. <td valign="top" class="bodybold">Press Releases <span
  136. class="bodysmall">[ <a href="press_archive.php?NewsCategoryID=2">View
  137. Archive for more stories</a]</span></td>
  138. </tr>
  139. <tr>
  140. <td valign="top" class="bodybold"</td>
  141. </tr>
  142. <tr>
  143. <td valign="top">
  144. <table width="100%" border="0" cellspacing="0"
  145. cellpadding="0">
  146. <?php do { ?>
  147. <tr align="left" valign="baseline">
  148. <td width="80" valign="top"><img src="images/icon_doc.gif"
  149. width="10" height="10"<?php echo DoDateTime(
  150. $row_rsPressReleases['NewsDate'], 'm/d/y'); ?:</td>
  151. <td valign="top"><a href="pressdetail.php?NewsID=<?php echo
  152. $row_rsPressReleases['NewsID']; ?>"><?php echo
  153. $row_rsPressReleases['NewsShort']; ?...</a></td>
  154. </tr>
  155. <tr align="left" valign="baseline">
  156. <td height="10" colspan="2" valign="top"><img
  157. src="images/spacer10x10.gif" width="10" height="10"></td>
  158. </tr>
  159. <?php } while ($row_rsPressReleases =
  160. mysql_fetch_assoc($rsPressReleases)); ?>
  161. </table>
  162. </td>
  163. </tr>
  164. <?php } // Show if recordset not empty ?><?php if
  165. ($totalRows_rsAdvisories 0) { // Show if recordset not empty ?>
  166. <tr>
  167. <td valign="top" class="bodybold"</td>
  168. </tr>
  169. <tr>
  170. <td valign="top" class="bodybold">Media Advisories <span
  171. class="bodysmall">[ <a href="press_archive.php?NewsCategoryID=3">View
  172. Archive for more stories</a]</span></td>
  173. </tr>
  174. <tr>
  175. <td valign="top" class="bodybold"</td>
  176. </tr>
  177. <tr>
  178. <td valign="top">
  179. <table width="100%" border="0" cellspacing="0"
  180. cellpadding="0">
  181. <?php do { ?>
  182. <tr align="left" valign="baseline">
  183. <td width="80" valign="top"><img src="images/icon_doc.gif"
  184. width="10" height="10"<?php echo DoDateTime(
  185. $row_rsAdvisories['NewsDate'], 'm/d/y'); ?:</td>
  186. <td valign="top"><a href="pressdetail.php?NewsID=<?php echo
  187. $row_rsAdvisories['NewsID']; ?>"><?php echo
  188. $row_rsAdvisories['NewsShort']; ?...</a></td>
  189. </tr>
  190. <tr align="left" valign="baseline">
  191. <td height="10" colspan="2" valign="top"><img
  192. src="images/spacer10x10.gif" width="10" height="10"></td>
  193. </tr>
  194. <?php } while ($row_rsAdvisories =
  195. mysql_fetch_assoc($rsAdvisories)); ?>
  196. </table>
  197. </td>
  198. </tr>
  199. <?php } // Show if recordset not empty ?>
  200. <tr>
  201. <td valign="top"><img src="images/spacer10x10.gif"
  202. width="100%" height="18"></td>
  203. </tr>
  204. </table>
  205. <div>
  206. <em><font color="#996699"></font></em></div>
  207.  
  208. </td></tr></tbody></td></tr></tbody></table>
  209. <table class="bottomtable" cellspacing="0" cellpadding="5" width="650"
  210. align="center" bgcolor="#ffffff" border="0">
  211. <tbody>
  212. <tr>
  213. <td valign="top" align="center">
  214.  
  215.  
  216. <p align="center" class="footer">
  217. <?php include(DIR_INCLUDES . 'footer.php'); ?>
  218. </p>
  219. </body>
  220. <!-- InstanceEnd --></html>
Aug 21 '06 #1
1 2030
jdurden wrote:
am currently woking on building this site: www.maverick-spirit.com.
everything seems to be fine except the press releases page. When you
click on one of the press releases in the left column under the menu,
nothing comes up. I copied the code for the page directly from the
press releases page on our main site: www.maverickentertainment.cc, and
it is using an identical database, so I am unsure what is wrong.

The issue happens when you click one of the press releases in the left
column. The pressdetail.php page should open up with the text of the
press release. Instead, it is just blank. Then, when you click "Press
Releases", it should go to the page press.php. The following error
occurs when trying to access press.php: "Warning: mysql_fetch_assoc():
11 is not a valid MySQL result resource in
/home/mavetcom/public_html/press.php on line 80"

This is the line in question:

<?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>

Hi,

That error means that the var named $rsNews is NOT containing the results of
a query.
The reason for the error lies BEFORE that line.
Check where you make/fill $rsNews earlier in your script.

Note: If you are too lazy to clean up your code before posting, don't expect
anyone here to do it for you.

Next time you need help, try this:
1) Remove ALL noise that has nothing to do with your problem, like 99.9% of
your current HTML.
2) Remove all PHP-stuff untill you reach the bare raw problem.

Often during this process you will find the problem yourself, if not, post
it.

I don't want to lecture you, but posting a few kilobytes of noise with a few
lines of relevant code is NOT the best way to receive help in a (any)
newgroup. :-)

Regards,
Erwin Moller

Aug 23 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its...
2
by: techy techno | last post by:
hii Experts..!! I need someone to tell me where I can get a Currency Converter like http://cconv.textor.com please can someone tell me where I can get it I need it for free + I dont need...
2
by: news.frontiernet.net | last post by:
I do a community web site and would like to provide a Button/icon for other loacal and area web sites to copy/paste on their web sites. I want to go BEYOND a simple image, to include a mouse-over...
8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
3
by: Shawn | last post by:
Hi. I have an XML file that looks like this: <?xml version="1.0" encoding="utf-16"?> <Transfer> <Config xmlns="http://www.mysite.com/Transfer/"> <site>NY</site> </Config> </Transfer> I'm...
4
by: Dave | last post by:
Hi, I'm new to asp.net and visual studio .net. I'm trying to fix a few problems on a friend's web site and don't really understand how .net works. The site is in .net. All asp.net pages...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
8
by: Lloyd Sheen | last post by:
I have a list of JPG's which are found in a SQL Server database. When the page selects a certain piece of data it will refer to the file system (resident on IIS server with a virtual directory)...
3
by: asafok | last post by:
I have the attached code is the site i'm working on and I need to remove the <br/> node that comes after the " <div id="win_233906"... " my question is : how can I get access to the <br/> and how...
1
by: vozzek | last post by:
Hi everyone, For the past four months I've been working on a retail website. Built it from scratch, including the shopping cart, which uses a mySQL database indexed by session id. All the pages...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.