find if string none?
#1

Hello, I'm a little confused here

I made a gang mysql system, where one field to save the name of the member
I want to ask, how to add users without bumping into members who are already in the alley?
pawn Код:
stock AddMember(playerid, giveplayerid, gangid)
{
    format(query, sizeof(query), "SELECT `GangMem` FROM `gang` WHERE `ID` = '%d'",gangid);
    mysql_query(mysql, query);
    cache_get_data(rows, fields);
    if(rows)
    {
        cache_get_field_content(0, "GangMem", query);
        sscanf(query, "p<,>sssss", gnamtemp[0],gnamtemp[1],gnamtemp[2],gnamtemp[3],gnamtemp[4]);
Reply
#2

This is not the proper way to go about it. A field should only ever contain one nominal value. Delimited lists are simply not done. There is a tutorial in my sig about association tables which you may find useful.
Reply
#3

um, or maybe I have to separate between the members of the group? The above is the way I wrong?

What impact, if I still choose to use the way I like above?
Reply
#4

That's not wrong, but that's a bad way to save gang members in 1 column.
You should've make one more table for gang members and add foreign key to your gang table. That way will make you easier to add / remove a gang member.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)