Leif K-Brooks <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I operate a small game site for kids.  On this site, the players  can,
among
> other things, buy virtual items.  I have each item stored in a table
called
> "items" in a mysql database.  The type is one column in that table, but it
> is a number, not a name.  When I want to display items with the item name,
I
> have to send a query to the item_types table to get the type name.  The
> problem is, if a user has 50 items, it takes 50 queries to get the types.
> Is there any better way?

Precache the item names in the items table, or use a join to get both item
numbers
and names in one query

select t.name, i.num from items i, item_types t
  where t.num = i.num and i.user=$userid



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to