Help mysql
#1

Hello! How do I check which one to check if the account exists in the database?
I tried this:
PHP код:
                mysql_format(mysqlszQuery128"SELECT * FROM `users` WHERE `Username` = '%s' LIMIT 1;"banname);
                
mysql_query(mysqlszQuery);
                if(
cache_get_row_count(mysql) > 0)
                {
                    
SendClientMessage(playeridCOLOR_GENERAL2"Acest cont (%s) nu exsista in baza de date."banname);
                    return 
1;
                } 
but does not work.
I use mysql r39-2
Reply
#2

help me
Reply
#3

help?
Reply
#4

pawn Код:
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `users` WHERE `Username` = '%e' LIMIT 1;", banname);
new Cache:result = mysql_query(mysql, query);
if(cache_get_row_count() > 0)
{
    //if the user exists in database
}
else {
    //If it doesnt exists
     }
cache_delete(result);
Reply
#5

How can I find the name written in order?

ban offline command.
PHP код:
new length strlen(cmdtext);
                while ((
idx length) && (cmdtext[idx] <= ' '))
                {
                    
idx++;
                }
                new 
offset idx;
                new 
tmp2[64];
                while ((
idx length) && ((idx offset) < (sizeof(tmp2) - 1)))
                {
                    
tmp2[idx offset] = cmdtext[idx];
                    
idx++;
                }
                
tmp2[idx offset] = EOS;
                if(!
strlen(tmp2)) return SendClientMessage(playeridCOLOR_SERVER"Foloseste: {FFFFFF}/ban [playerid] [motiv]");
                new 
result[64];
                while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                {
                    
result[idx offset] = cmdtext[idx];
                    
idx++;
                }
                
result[idx offset] = EOS;
                 if(!
strlen(tmp)) return SendClientMessage(playeridCOLOR_SERVER"Foloseste: {FFFFFF}/ban [playerid] [motiv]");
                   new 
name[256];
                
mysql_format(mysqlszQuerysizeof(szQuery), "SELECT * FROM `users` WHERE `Username` = '%e' LIMIT 1;"name);
                new 
Cache:ez mysql_query(mysqlszQuery);
                if(
cache_get_row_count() > 0)
                {
                    
format(szQuerysizeof(szQuery),"UPDATE `users` SET `Banned` = '1' WHERE `Name` = '%s'"giveplayer);
                    
mysql_tquery(mysqlszQuery"" "" );
                    if(
PlayerInfo[playerid][pLanguage] == 1) { format(stringsizeof(string), "%s(offline) a primit ban de la adminul %s, motiv: %s."namesendername, (result)); }
                    else if(
PlayerInfo[playerid][pLanguage] == 2) { format(stringsizeof(string), "%s(offline) was banned from admin %s, reason: %s."namesendername, (result)); }
                    
SendClientMessageToAll(COLOR_CMDstring);
                }
                else
                {
                    
SendClientMessage(playeridCOLOR_GENERAL2"Acest cont (%s) nu exista in baza de date."name);
                }
                
cache_delete(ez); 
Reply
#6

Use strcmp.
help please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)