Hi, Why don't you add another column to your "items" table for the item name..Then you can just fetch each row to an array and call it by $row["item_name"] ? For better explanation: Say you added a column to hold item names in your items table called item_name ... I have no idea how you query items table based on which customers has what items because you stated that there was only coumn in items table, but if you were to query everything in the items table, you'd do:
$query="select * from items"; $result=mysql_query($query); $num_results = mysql_num_rows($result); for($i=0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); // then you can reach item number and item name just by calling them $itemnumber= $row["number"]; //assuming that the column that holds the item numbers has the name number $itemname= $row["item_name"]; // assuming that the column you'll add for item names will have the name iten_name } Does this make sense to you? Or are you looking for something else? Let us know... Thanks, Gurhan -----Original Message----- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 1:41 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Is there a better way to do this? 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? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php