Jump to content

selecting something from multiple table items


advancedfuture

Recommended Posts

So I don't know exactly how to form a query to select a certain value from multiple items in the database.

 

I have a table called items.. in that table are 2 rows, item_name and item_cost

 

I have 4 items in the database. it looks as follows

item_name  |  item_cost

------------------------

book          |      100

candy        |      45

flashlight    |      75

gum          |      10

 

 

I want to get the individual item_cost of only book and flashlight.. I know how to do this in 2 seperate queries, but is there a way I can get the item_cost for those those items in a single query? Thanks!

 

ok let me rephrase, i guess it would be easier to ask this.

 

How do I combine these 2 queries into one.. that will solve my problem

 

 

$query = "SELECT * FROM toon WHERE name='$username'";

$query2 = "SELECT * FROM items";

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.