View Single Post
  #20  
Old 01-09-2009, 06:59 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by WhiteDragon View Post
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 `itemsWHERE `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.
yo remind me whether you are a Deek parachute account
Reply With Quote