Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: PHP Errors

  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Errors

    Thank you for taking the time to help me with my somewhat "newbie" problem.

    I was recently given a content management system by one of my friends... I unzipped it, put it in the correct directory, etc. I set up the database, and did everything right... When I go to the pages, it says things like:

    Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /public_html/cms/cms/news.php on line 25

    AND

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/cms/cms/news.php on line 15

    AND

    Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /public_html/cms/cms/showMenu.php on line 6



    I asked my friend, and he said that this was due to an incorrect username and or password. I changed everything, went over it, triple checked it, and I get the same thing! I know that the Content Management System works, because it is on his site as well. Also, the username and passwords are drawn from one file:

    PHP Code:
    <?php
    //Database configuration
    $db_server "localhost"//Usually localhost, ask your webhosting provider if localhost does not work
    $db_user "********_admin"//Database username; consult web host for instructions on setting up a database user
    $db_password "************"//Database password, consult web host for instructions on setting up a database user
    $db_database "********_******"//You may create a new database or have cms share a database with something else

    //Internal variable configuration
    $settings['table_prefix'] = "ffc_"//If cms is sharing a database with something else, you might want to have a prefix.
    $settings['list_tags'] = "1"//Set to 1 if you want to list a static page's tags in the body, 0 if you don't.
    $settings['site_title'] = "interweb";
    //Don't bother with anything below this line

    $db_connection mysql_connect("$db_server","$db_user","$db_password");
    if (!
    $db_connection)
      {
      die(
    'Could not connect: ' mysql_error());
      }
    mysql_select_db($db_database$db_connection);
    ?>

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    It should be mysql_num_rows, I'd change that if I was you.

    If your username, password etc was wrong, then you'd get the error saying you couldn't connect. Now as you're connected and getting the errors, with mysql_num_rows not returning anything, I'd say it's due to either your database being empty, or a problem with your query. But as you're not showing the code for that page, I can't help you

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is the code for the main, front page (the page that matters, with all the news and stuff I want inserted).

    PHP Code:
    <?php require_once("common.php"); ?>
    <html>
    <head>
        <title>test</title>
        <link href="style.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <?php
        
    function newHref($path) { //broken...
            
    $self $_SERVER['PHP_SELF'];
            echo 
    "$self" "&" "page=$path";
        }
    ?>
    <table width="100%">
        <tr>
            <td colspan="3" class="header">
                
                <h1><?php echo $settings['site_title']; ?></h1>
                <table class="toptable">
                    <tr>
                        <td>
                <?php require_once("cms/showMarquee.php"); ?>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <span class="links">
                                <? include("cms/showMenu.php"); ?>
                            </span>
                        </td>
                </table>
                
            </td>
        </tr>
        <tr>
            <td width="180">
            </td>
            <td width="%" valign="top">
                <?
                    
    if(isset($_GET['page'])) {
                        
    $page $_GET['page'];
                        include(
    $page);    
                    }
                    else {
                        
    ?>
                        <center>
              <h2><?php 
              
    if(isset($_GET['pageTitle'])) {
                echo 
    $_GET['pageTitle']; 
              }
              else {
                echo 
    "News";
              }
              
    ?></h2>
                        </center>
                        <?
              
    if(isset($_GET['content'])) {
                            require_once(
    $_GET['content']);
                        }
                        else {
                            require_once(
    "cms/news.php"); 
                        } 
              
    ?>
                        
                        <?
                    
    }
                
    ?>
            </td>
            <td width="280" valign="top" align="center">
                
                <?php require_once("cms/latestPosts.php");
                echo 
    "<br><br>";
                require_once(
    "fgs.php"); //This is the random image generator
                
    echo "<br /><br />";
                
    ?>
                
                <br><br>><br>
                <br>
                
            </td>
        </tr>
    </table>

    </body>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •