Results 1 to 2 of 2

Thread: MySQL DATABASE ERROR?????

  1. #1
    Join Date
    Nov 2006
    Location
    90 miles north of Las Vegas
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation MySQL DATABASE ERROR?????

    Hi.

    I am trying to design a page with the main content and sidebar dynamic with MySQL and PHP. The below code is what I use to connect and echo the contents (well except for my user,pass,db name etc).

    PHP Code:

    <?

    $con 
    mysql_connect("mysql.server.com","joe","soap");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("my_database"$con);
    $result mysql_query("SELECT * FROM abc");
    $row mysql_fetch_array($result);

    echo 
    "This is: <br> ".$row['fld_Content']."<br>".$row['fld_Sidebar']." ";

    ?>
    However this error keeps coming up.

    Code:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
    Has this got something to do with the PHP.INI file ? Or something in my code?

    // If it the php.ini file, how can i fix it?

    Thanks!~
    Last edited by Tristan S.S.; 02-18-2007 at 06:45 PM. Reason: stuff next to //

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    That error message has to do with the query to the database. Either the database "my_database" or the table in the database "abc" is none existant (spelling?) or there are no rows in the db for the fetch array to work.

    Hope this helps.

Bookmarks

Posting Permissions

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