SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Aug 30, 2002, 23:39 #1
- 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
-
Aug 31, 2002, 03:41 #2
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.
-
Aug 31, 2002, 07:00 #3
- 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);
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