need help with php code on this site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jdurden

    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_ass oc():
    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_ass oc($rsNews)); ?>





    Here is the PHP code for pressdetail.php :

    Code:
    <?php require('Connections/connDatabase.php'); ?>
    
    <?php
    $colname_rsNews = "1";
    if (isset($HTTP_GET_VARS['NewsID'])) {
    $colname_rsNews = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['NewsID']
    : addslashes($HTTP_GET_VARS['NewsID']);
    }
    mysql_select_db($database_connDatabase, $connDatabase);
    $query_rsNews = sprintf("SELECT NewsID, NewsName, NewsDate, NewsShort,
    NewsFull FROM News", $colname_rsNews);
    $rsNews = mysql_query($query_rsNews, $connDatabase) or
    die(mysql_error());
    $row_rsNews = mysql_fetch_assoc($rsNews);
    $totalRows_rsNews = mysql_num_rows($rsNews);
    require('includes/configure.php'); ?>
    <html><!-- InstanceBegin template="/Templates/pagelayout2003.dwt.php"
    codeOutsideHTMLIsLocked="false" -->
    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title><?php echo substr($row_rsNews['NewsShort'], 0, 50);
    ?>...</title>
    <meta name="description" content="<?php echo $row_rsNews['NewsShort'];
    ?>">
    <!-- InstanceEndEditable -->
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <meta name="keywords" content="Maverick Entertainment, Maverick Home
    Video, Doug Schwab, Urban Film Distribution, Urban Film Production,
    Urban Films, Urban Movies, gangsta movies, a miami tail, african
    american movies, Afro-American Movies, American Black Film Festival,
    black african american movies, Black Cinema, black film festivals,
    Black Films, Blockbuster Distribution, blockbuster video, dvd movies,
    eva longoria, film distribution, film makers, film production
    companies, hip hop movies, hollywood black film festival, independent
    film festivals, independent film production, independent films, latino
    actresses, latino movies, Maverick Pictures, movie production
    companies, rapper trina, Rappers in Movies, trina the rapper">
    <link href="styles.css" rel="stylesheet" type="text/css">
    <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable
    --><!-- InstanceParam name="onload" type="text" value="" -->
    </head>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="100%"  border="0" cellpadding="0" cellspacing="0"
    background="../images/headerbg.jpg" style="border-bottom:1px solid
    #cccccc;">
    <tr>
    <td height="75">&nbsp;</td>
    
    <td width="580" height="75" align="right" valign="bottom"><img
    src="../images/division.gif" width="273" height="20"
    style="margin-bottom:5px; margin-right:10px;"></td>
    <td height="75">&nbsp;</td>
    </tr>
    </table>
    <table width="100%">
    <tr>
    <td height="100">&nbsp;</td>
    
    <td width="5000" height="100" align="center" valign="middle"><div
    style="position:relative;top:7px"><img src="../images/spirit.jpg"
    width="760" height="100" class="pictureframe"></td>
    <td height="100">&nbsp;</td>
    </tr>
    </table>
    <table width="760"  border="0" align="center" cellpadding="0"
    cellspacing="0" style="margin-top:15px;">
    <tr align="left" valign="top">
    <td width="180">
    <?php include(DIR_INCLUDES . 'leftcol.php'); ?>
    <!-- InstanceBeginEditable name="leftcol" --><!-- InstanceEndEditable
    --></td>
    <td width="10"><img src="../images/spacer.gif" width="10"
    height="10"></td>
    <td class="contentarea"><!-- InstanceBeginEditable name="content"
    -->
    <h1><img src="images/spiritpress.jpg" alt="" height="81"
    width="536" border="0"></h1>
    <table width="380" border="0" cellspacing="4" cellpadding="0"
    align="center">
    <tr>
    <td valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td valign="top"><a href="../press.php">&laquo; Press
    Releases</a></td>
    </tr>
    <tr>
    <td class="bodystandard" valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td class="bodystandard" valign="top"><?php echo
    $row_rsNews['NewsFull']; ?></td>
    </tr>
    <tr>
    <td valign="top"><img src="../images/spacer10x10.gif"
    height="18" width="100%"></td>
    </tr>
    </table>
    <div>
    <em><font
    color="#996699"></font></em></div>						</td></tr></tbody></td></tr></tbody></table>
    <table class="bottomtable" cellspacing="0" cellpadding="5" width="650"
    align="center" bgcolor="#ffffff" border="0">
    <tbody>
    <tr>
    <td valign="top" align="center">
    
    
    <p align="center" class="footer">
    <?php include(DIR_INCLUDES . 'footer.php'); ?>
    </p>
    </body>
    <!-- InstanceEnd --></html>



    and the code for press.php:

    Code:
    <?php require_once('Connections/connDatabase.php'); ?>
    <?php require('includes/configure.php'); ?>
    <?php
    mysql_select_db($database_connDatabase, $connDatabase);
    $query_rsNews = "SELECT SQL_CACHE NewsCategory, NewsID, NewsName,
    NewsDate, NewsShort, NewsActive FROM News WHERE NewsCategory = 1 AND
    NewsActive = 'Yes' ORDER BY NewsDate DESC LIMIT 5";
    $rsNews = mysql_query($query_rsNews, $connDatabase) or
    die(mysql_error());
    $row_rsNews = mysql_fetch_assoc($rsNews);
    $totalRows_rsNews = mysql_num_rows($rsNews);
    
    mysql_select_db($database_connDatabase, $connDatabase);
    $query_rsPressReleases = "SELECT SQL_CACHE NewsCategory, NewsID,
    NewsDate, NewsShort, NewsActive FROM News WHERE NewsCategory = 2 AND
    NewsActive = 'Yes' ORDER BY NewsDate DESC LIMIT 5";
    $rsPressReleases = mysql_query($query_rsPressReleases, $connDatabase)
    or die(mysql_error());
    $row_rsPressReleases = mysql_fetch_assoc($rsPressReleases);
    $totalRows_rsPressReleases = mysql_num_rows($rsPressReleases);
    
    mysql_select_db($database_connDatabase, $connDatabase);
    $query_rsAdvisories = "SELECT SQL_CACHE NewsCategory, NewsID, NewsDate,
    NewsShort, NewsActive FROM News WHERE NewsCategory = 3 AND NewsActive =
    'Yes' ORDER BY NewsDate DESC LIMIT 5";
    $rsAdvisories = mysql_query($query_rsAdvisories, $connDatabase) or
    die(mysql_error());
    $row_rsAdvisories = mysql_fetch_assoc($rsAdvisories);
    $totalRows_rsAdvisories = mysql_num_rows($rsAdvisories);
    ?>
    <html><!-- InstanceBegin template="/Templates/pagelayout2003.dwt.php"
    codeOutsideHTMLIsLocked="false" -->
    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title><?php echo substr($row_rsNews['NewsShort'], 0, 50);
    ?>...</title>
    <meta name="description" content="<?php echo $row_rsNews['NewsShort'];
    ?>">
    <!-- InstanceEndEditable -->
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <meta name="keywords" content="Maverick Entertainment, Maverick Home
    Video, Doug Schwab, Urban Film Distribution, Urban Film Production,
    Urban Films, Urban Movies, gangsta movies, a miami tail, african
    american movies, Afro-American Movies, American Black Film Festival,
    black african american movies, Black Cinema, black film festivals,
    Black Films, Blockbuster Distribution, blockbuster video, dvd movies,
    eva longoria, film distribution, film makers, film production
    companies, hip hop movies, hollywood black film festival, independent
    film festivals, independent film production, independent films, latino
    actresses, latino movies, Maverick Pictures, movie production
    companies, rapper trina, Rappers in Movies, trina the rapper">
    <link href="styles.css" rel="stylesheet" type="text/css">
    <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable
    --><!-- InstanceParam name="onload" type="text" value="" -->
    </head>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="100%"  border="0" cellpadding="0" cellspacing="0"
    background="../images/headerbg.jpg" style="border-bottom:1px solid
    #cccccc;">
    <tr>
    <td height="75">&nbsp;</td>
    
    <td width="580" height="75" align="right" valign="bottom"><img
    src="../images/division.gif" width="273" height="20"
    style="margin-bottom:5px; margin-right:10px;"></td>
    <td height="75">&nbsp;</td>
    </tr>
    </table>
    <table width="100%">
    <tr>
    <td height="100">&nbsp;</td>
    
    <td width="5000" height="100" align="center" valign="middle"><div
    style="position:relative;top:7px"><img src="../images/spirit.jpg"
    width="760" height="100" class="pictureframe"></td>
    <td height="100">&nbsp;</td>
    </tr>
    </table>
    <table width="760"  border="0" align="center" cellpadding="0"
    cellspacing="0" style="margin-top:15px;">
    <tr align="left" valign="top">
    <td width="180">
    <?php include(DIR_INCLUDES . 'leftcol.php'); ?>
    <!-- InstanceBeginEditable name="leftcol" --><!-- InstanceEndEditable
    --></td>
    <td width="10"><img src="../images/spacer.gif" width="10"
    height="10"></td>
    <td class="contentarea"><!-- InstanceBeginEditable name="content"
    -->
    <h1><img src="images/spiritpress.jpg" alt="" height="81"
    width="536" border="0"></h1>
    <table width="380" border="0" align="center" cellpadding="0"
    cellspacing="4">
    <tr>
    <td valign="top"</td>
    </tr>
    <?php if ($totalRows_rsNews 0) { // Show if recordset not
    empty ?>
    <tr>
    <td valign="top" class="bodybold">In The News <span
    class="bodysmall">[ <a href="press_archive.php?NewsCategoryID=1">View
    Archive for more stories</a]</span></td>
    </tr>
    <tr>
    <td valign="top" class="bodybold"</td>
    </tr>
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0"
    cellpadding="0">
    <?php do { ?>
    <tr align="left" valign="baseline">
    <td width="80" valign="top"><img src="images/icon_doc.gif"
    width="10" height="10"<?php echo DoDateTime( $row_rsNews['NewsDate'],
    'm/d/y'); ?:</td>
    <td valign="top"><a href="pressdetail.php?NewsID=<?php echo
    $row_rsNews['NewsID']; ?>"><?php echo $row_rsNews['NewsShort']; ?>
    ....</a></td>
    </tr>
    <tr align="left" valign="baseline">
    <td height="10" colspan="2" valign="top"><img
    src="images/spacer10x10.gif" width="10" height="10"></td>
    </tr>
    <?php } while ($row_rsNews = mysql_fetch_assoc($rsNews)); ?>
    </table>
    </td>
    </tr>
    <?php } // Show if recordset not empty ?><?php if
    ($totalRows_rsPressReleases 0) { // Show if recordset not empty ?>
    <tr>
    <td valign="top" class="bodybold"</td>
    </tr>
    <tr>
    <td valign="top" class="bodybold">Press Releases <span
    class="bodysmall">[ <a href="press_archive.php?NewsCategoryID=2">View
    Archive for more stories</a]</span></td>
    </tr>
    <tr>
    <td valign="top" class="bodybold"</td>
    </tr>
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0"
    cellpadding="0">
    <?php do { ?>
    <tr align="left" valign="baseline">
    <td width="80" valign="top"><img src="images/icon_doc.gif"
    width="10" height="10"<?php echo DoDateTime(
    $row_rsPressReleases['NewsDate'], 'm/d/y'); ?:</td>
    <td valign="top"><a href="pressdetail.php?NewsID=<?php echo
    $row_rsPressReleases['NewsID']; ?>"><?php echo
    $row_rsPressReleases['NewsShort']; ?...</a></td>
    </tr>
    <tr align="left" valign="baseline">
    <td height="10" colspan="2" valign="top"><img
    src="images/spacer10x10.gif" width="10" height="10"></td>
    </tr>
    <?php } while ($row_rsPressReleases =
    mysql_fetch_assoc($rsPressReleases)); ?>
    </table>
    </td>
    </tr>
    <?php } // Show if recordset not empty ?><?php if
    ($totalRows_rsAdvisories 0) { // Show if recordset not empty ?>
    <tr>
    <td valign="top" class="bodybold"</td>
    </tr>
    <tr>
    <td valign="top" class="bodybold">Media Advisories <span
    class="bodysmall">[ <a href="press_archive.php?NewsCategoryID=3">View
    Archive for more stories</a]</span></td>
    </tr>
    <tr>
    <td valign="top" class="bodybold"</td>
    </tr>
    <tr>
    <td valign="top">
    <table width="100%" border="0" cellspacing="0"
    cellpadding="0">
    <?php do { ?>
    <tr align="left" valign="baseline">
    <td width="80" valign="top"><img src="images/icon_doc.gif"
    width="10" height="10"<?php echo DoDateTime(
    $row_rsAdvisories['NewsDate'], 'm/d/y'); ?:</td>
    <td valign="top"><a href="pressdetail.php?NewsID=<?php echo
    $row_rsAdvisories['NewsID']; ?>"><?php echo
    $row_rsAdvisories['NewsShort']; ?...</a></td>
    </tr>
    <tr align="left" valign="baseline">
    <td height="10" colspan="2" valign="top"><img
    src="images/spacer10x10.gif" width="10" height="10"></td>
    </tr>
    <?php } while ($row_rsAdvisories =
    mysql_fetch_assoc($rsAdvisories)); ?>
    </table>
    </td>
    </tr>
    <?php } // Show if recordset not empty ?>
    <tr>
    <td valign="top"><img src="images/spacer10x10.gif"
    width="100%" height="18"></td>
    </tr>
    </table>
    <div>
    <em><font color="#996699"></font></em></div>
    
    </td></tr></tbody></td></tr></tbody></table>
    <table class="bottomtable" cellspacing="0" cellpadding="5" width="650"
    align="center" bgcolor="#ffffff" border="0">
    <tbody>
    <tr>
    <td valign="top" align="center">
    
    
    <p align="center" class="footer">
    <?php include(DIR_INCLUDES . 'footer.php'); ?>
    </p>
    </body>
    <!-- InstanceEnd --></html>
  • Erwin Moller

    #2
    Re: need help with php code on this site

    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_ass oc():
    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_ass oc($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

    Comment

    Working...