Quote:
Originally Posted by darkslayer2004
WHERE `name` LIKE '".$id."'
|
Assuming $id is A-Z, wouldn't that get anything that ENDS with A-Z?
Bit confusing unless you specify what is in the name column and what the $id variable is.
What I was suggesting was something like this (a few example rows):
NPC Code:
id, category, letter, name
1, 1, A, Adventurers Mantle
2, 1, A, Amulet
3, 1, C, Chainmail
4, 1, R, Red Belt of Damage
5, 2, F, Ferry - Dustari to Main
etc etc.
id would be the primary key, and (category, letter) would be an index.
Then you could select like this
PHP Code:
SELECT FROM `items` WHERE `category` = '1' AND `letter` = 'A'
Which would in my example get all the items in 'Kingdoms - Armour' that start with an 'A'.
But like I said, it would require you to update the letter column if you ever update the name of the item.