need help with a simple fetch mysql_query

Shaz

Member
Jan 8, 2015
57
1
im trying to get the specific amount of furniture in the items database, ive done this code

<?php
$query = mysql_query("SELECT COUNT(*) AS id FROM items") or die(mysql_error());
$data = mysql_fetch_assoc($query);

echo $data['id'];
?>

but it tells you the amount of all the furniture but i want to to just select certain id numbers from the items id table
im trying to show how many eg ( Thrones ) are on the hotel for example

There are currently (40) thrones on the hotel
if anybody knows the php code to add correctly it would be helpful thanks.
 

aliking

New Member
Jul 9, 2014
20
8
Hey, I'd suggest using this piece of PHP code:
<?php
$query = "SELECT * FROM items WHERE base_item = 'THRONE BASE ITEM';"; // You'll need to search your "furniture" table to get the Thrones base item ID.
$amount = mysql_num_rows(mysql_query($query));
echo $amount; // Echo's the amount.
?>
 

Users who are viewing this thread

Top