SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    output is Resource id #4???????

    my code is following :

    <? $result = mysql_query("SELECT pr_yearbuilt
    FROM property WHERE property.pr_code=485");
    echo "<p>$result</p>";
    ?>

    in my out put i get : Resource id #4


    what am i doing wrong
    it should give me a value
    newibie please help

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    What you get when the query is executed is a result resource, not the value. You can use that resource together with the available functions for result handling, like mysql_result and mysql_fetch_assoc.

    PHP Code:
    $result mysql_query("SELECT pr_yearbuilt
    FROM property WHERE property.pr_code=485"
    );

    $row mysql_fetch_assoc($result);
    echo 
    "<p>{$row['pr_yearbuilt']}</p>"
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up :d

    Man I could kiss you!

    Thanx for the help it works!

    I did try to fix with mysql_fetch_object but that gave me even more probs.

    anyways thnx!

  4. #4
    SitePoint Evangelist djdykes's Avatar
    Join Date
    Feb 2005
    Location
    Chester, Cheshire
    Posts
    565
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yo, i wrote this, maybe it will help give you a better idea of pulling info from a DB...

    http://www.php-for-beginners.co.uk/page/56


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
  •