SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2002
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Retrieving data from tbl (problem)

    hi, i got this

    mysql_db_query($dbname,"SELECT wood from gamerecource");

    I want to get back the default value, but instead i get back 'Resource id #2', i don't have a clue what it means all i really need is the code to get the default value back from the tbl instead of the weird 'Recource id #2'

    please help me

  2. #2
    SitePoint Guru Husain's Avatar
    Join Date
    Sep 2001
    Posts
    620
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The default value returned by mysql_db_query IS a resource ID. To get values from the table you need to write some more codes:
    PHP Code:
    $ResultID mysql_db_query($dbname'SELECT wood FROM gamerecource');

    $Record mysql_fetch_array($ResultID); // Assuming that there is only one record in the database.

    echo($Record['wood']); 
    Last edited by Husain; Aug 31, 2002 at 03:47.

  3. #3
    SitePoint Member
    Join Date
    Aug 2002
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmz, i used it and now i have:
    PHP Code:
    $ResultID mysql_db_query($dbname'SELECT wood FROM gamerecource'); 

    $countwood2 mysql_fetch_array($ResultID); 
    but now i get:

    Fatal error: Unsupported operand types in /home/virtual/site99/fst/var/www/html/test/buildings/lumbermill.php on line 46

    im totally sure it has to do with $countwood2 = mysql_fetch_array($ResultID); , but i don't excactly know what's wrong


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
  •