#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    1
    Rep Power
    0
    When i use this code:

    <?php
    $global_dbh = mysql_connect( 'localhost:/tmp/mysql.jenkins2' , 'root' , 'XXXXXXXXXXX.');
    $db = "bgsuas";
    mysql_select_db( $db, $global_dbh );
    $theheadline = mysql_query("SELECT headline FROM news");
    echo $theheadline;
    ?>

    it sets $theheadline = to Resource id #2 instead of the value from the database. Please help!

    Thanks,

    Stephen
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    mysql_query() returns a result index (2 in this example).

    To actually access the data you'll need to use one of the various functions designed for that:

    mysql_fetch_row()
    mysql_fetch_array()
    mysql_retult()

Similar Threads

  1. Replies: 1
    Last Post: January 30th, 2004, 12:46 PM
  2. invalid result resource? (different from FAQ)
    By sir_paco in forum PHP Development
    Replies: 8
    Last Post: November 4th, 2003, 09:29 AM
  3. File-Handle resource
    By kojr in forum PHP Development
    Replies: 10
    Last Post: October 21st, 2002, 02:18 PM
  4. file upload- check if somethings there
    By MkJnr in forum PHP Development
    Replies: 9
    Last Post: March 19th, 2002, 02:14 PM
  5. is not a valid PostgreSQL link resource
    By jumper9308 in forum PostgreSQL Help
    Replies: 5
    Last Post: January 14th, 2002, 09:30 AM

IMN logo majestic logo threadwatch logo seochat tools logo