PHP_PhREEEk Posted December 1, 2007 Share Posted December 1, 2007 Try typing it in with an escape in front of the comma: weapons\,2 By the way, you are breaking an awfully BIG MySQL rule here, and that is: NEVER use commas in fields to separate data items. If you need to do this, then your database is NOT properly normalized. Commas should only be allowed in text fields where it is a part of normal text. You should address this issue, and then you won't have this problem. MySQL was designed to take a comma separated list of items and store them as nuclear values with relationships. It wasn't designed to store comma separated items as a whole. Defeats the whole architecture! PhREEEk Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted December 1, 2007 Author Share Posted December 1, 2007 how should I separate data in the same column then? basically this is for my text game, and when a user buys a weapon, I want it to add the ID of the weapon to that column, so if I cant use a comma(or shouldnt use a comma), how should I go about this? Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 1, 2007 Share Posted December 1, 2007 how should I separate data in the same column then? basically this is for my text game, and when a user buys a weapon, I want it to add the ID of the weapon to that column, so if I cant use a comma(or shouldnt use a comma), how should I go about this? Just adding the 2 should be sufficient. We can say that weapon = '2' whereas your query is suggesting: weapon = 'weapon => 2', which is redundant. As far as normalizing your database to better serve your data needs, that's almost impossible without knowing exactly what your game does and how the database is constructed to begin with. All I can tell you is that if your database is properly normalized, then your querys will be easier and more logical, and your code will be likewise. From what I can see, it seems apparent that you should have a table named `weapons`, which have ID numbers and their own unique properties (such as weapon NAME, etc..). One such weapon might have an ID of '2'. If UserID '1' has weapon '2', then there's a relationship we can act upon, either by viewing it, modifying it, or deleting it. PhREEEk Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.