User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,646 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,829 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

Need Help with converting an ID to a Name

Join Date: Oct 2007
Posts: 2
Reputation: jtmcgee is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jtmcgee jtmcgee is offline Offline
Newbie Poster

Help Need Help with converting an ID to a Name

  #1  
Oct 7th, 2007
  1. if( $rand_num <= $chance )
  2. {
  3. //$item_id = mysql_query("SELECT `item` FROM `creatures` WHERE id = '$id_creature'");
  4. $foo =& creature_stats( item, $id_creature );
  5.  
  6. $item_query = mysql_query("SELECT * FROM items WHERE id = '$foo'") or ('$item_query');
  7.  
  8. $item = mysql_fetch_array($item_query);
  9.  
  10. echo"You got an ".$item."!";
  11.  
  12. }

Creature Stats Function:

  1. function &creature_stats($what_stat, $id)
  2. {
  3. $mysql_query=mysql_query("SELECT * FROM `creatures` WHERE `id` = '$id'");
  4. $info=mysql_fetch_array($mysql_query);
  5. return $info[$what_stat];
  6. }

I need help getting it to echo $item

It justs puts out nothing.
Last edited by jtmcgee : Oct 7th, 2007 at 4:50 pm.
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 1:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC