View Single Post
  #1  
Old 12-14-2013, 09:25 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Some SQL / db Questions...

So I am trying to set up a db that stores two lists specific to a user in regards to quests they have completed, or not completed. I figure this could be used as a db for item storage if need be, but this was the simplest purpose I could think of.

ex column names:
owner , complete, incomplete

First question:
Would it be best to associate the owner by player.account or player.communityname ? I am currently using player.account.


Second Question / my issue..:
As far as how data is stored in a single column, if there are multiple things (ex: inc1, inc2) I have written a function to gather that data:

PHP Code:
/*-------- getQuestsIncomplete------------
getQuestsIncomplete(temp.owner)
only for incomplete quests right now**
Set arguments: incomplete , quest_users
-----------------------------------*/

function getQuestsIncomplete(temp.owner)

  
temp.check escapestring2(temp.owner);
  
temp.statement "SELECT incomplete FROM quest_users WHERE owner = '"@temp.check@"' ";
  
  
//Query
  
temp.req requestSQL(temp.statement,true);
  
  
//Does this exist?
  
if (temp.req.rows.size() == 0)
    {
      return 
NULL;
    }
  return 
temp.req.rows[0][0]; 

this will return inc1, inc2 without any " ".

If I write another function to update that list, I've tried adding to it as if it was an array, and any time I do, it just returns 0 afterwards (Echoing in rc).

This was an issue I was anticipating as I will eventually store a lot of information in a single column, which could be a bad design, but I would appreciate some insight on how to get this functioning if I am doing something wrong. Or, a better method for this wouldn't hurt either.

Thanks.

Edit: wanted to include what I'm going to use this for later on...

I was going to set up a GUI for the user to pull a list of quests they have either completed or not completed from.

The names will be internal names for a separate db that stores all the quest specific info to display once a user had selected that quest.
__________________
Quote:
Originally posted by Spark910
Think befreo you type.

Last edited by Torankusu; 12-14-2013 at 11:47 PM..
Reply With Quote