[Plugin] [REL] MySQL Plugin (Now on github!)

Quote:
Originally Posted by Span1ard
Посмотреть сообщение
Код:
- the plugin reconnects automatically incase you are using a threaded callback
possible disable it?
Why would you want to do that? You can disable it if you change the source yourself.
Reply

PHP код:
forward checkChat();
public 
checkChat()
{
    new 
query[256];
    
format(query256"SELECT * FROM `" TABLE_PREF "chat` WHERE `id` > %d ORDER BY `id` ASC"lastChatId);
    
mysql_query(query);
    
mysql_store_result();
    
    while(
mysql_next_row())
    {
        new 
d[32];
        
        
mysql_get_field("id"d);
        print(
d);
        
        
mysql_get_field("name"d);
        print(
d);
        
        
mysql_get_field("message"d);
        print(
d);
    }
    
    
mysql_free_result();

this code didn't work, why?
Reply

@Romanius: Perform the query in phpMyAdmin and see if you get any results (update the criteria where necessary).
Reply

this query from my php script and its work perfect.
Reply

What's returned when you execute the code? Check your error log / enable debugging from the plugin.
Reply

it crashes server. print only this:
PHP код:
mysql_get_field("id"d);
print(
d); 
then server shut down
Reply

pawn Код:
forward checkChat();
public checkChat()
{
    new query[256];
    format(query, 256, "SELECT * FROM `" TABLE_PREF "chat` WHERE `id` > %d ORDER BY `id` ASC", lastChatId);
    mysql_query(query);
    mysql_store_result();
   
    while(mysql_next_row())
    {
        new d[32], e[32], f[32];
       
        mysql_get_field("id", d);
        print(d);
       
        mysql_get_field("name", e);
        print(e);
       
        mysql_get_field("message", f);
        print(f);
    }
   
    mysql_free_result();
}
Reply

Try to use
Код:
while(mysql_fetch_row())
and try to use sscanf.
Reply

Quote:

and try to use sscanf.

with sscanf work fine, but why didn't work my code?

with sscanf variant doesn't suit me
Reply

never mind...
Reply

my mistake! i have newer libmysql.dll! all works fine with "old" .dll
Reply

hello... i wanna use this plugin on Debian 6, what should i do for use it on Debian 6? cand someone help me?
As it is now, it doesn't work..
Reply

Hey guys!

I have an error:

Код:
Failed (libmysqlclient_r.so.15: cannot open shared object file: No such file or directory)
My host is using linux and I have put the needed files and I have add at plugins in server.cfg. And my host has putted the file that is needed. But it doesn't work. Any ideas how to fix it?
Reply

Help,i need to save and load 111 items ,and sscanf didn't suport 111 parameters,how can i do to save and load it?Just a small example
PS:I use GF..
Reply

Simply don't use sscanf? mysql_retrieve_row + mysql_fetch_field_row would do the job.
Reply

mysql_affected_rows() is buggy. Even when rows get inserted there are times where it will return an incorrect value.
Reply

I have a problem.

pawn Код:
CMD:mystat(playerid, params[])
{
    new StrSTAT[30];
   
    format(StrSTAT, sizeof(StrSTAT), "cash: %d, exp: %d", MySQL_GetInt(playerid, "pieniadze"), MySQL_GetInt(playerid, "exp"));
    SendClientMessage(playerid, -1, StrSTAT);
    return 1;
}

MySQL_GetInt(playerid, fieldname[])
{
    new ret_field;
   
    mysql_query_format("SELECT `%s` FROM `KontaGraczy` WHERE 'login' = '%s'", fieldname, PlayerName(playerid));
    mysql_store_result();
   
    ret_field = mysql_fetch_int();
   
    mysql_free_result();
    return ret_field;
}
Func MySQL_GetInt return "-1" and it should return "pieniadze" (520000$)

How to fix?
Reply

what is the limit of mysql?
Reply

Why limit ?
Reply

Quote:
Originally Posted by TomTroX
Посмотреть сообщение
I have a problem.

pawn Код:
CMD:mystat(playerid, params[])
{
    new StrSTAT[30];
   
    format(StrSTAT, sizeof(StrSTAT), "cash: %d, exp: %d", MySQL_GetInt(playerid, "pieniadze"), MySQL_GetInt(playerid, "exp"));
    SendClientMessage(playerid, -1, StrSTAT);
    return 1;
}

MySQL_GetInt(playerid, fieldname[])
{
    new ret_field;
   
    mysql_query_format("SELECT `%s` FROM `KontaGraczy` WHERE 'login' = '%s'", fieldname, PlayerName(playerid));
    mysql_store_result();
   
    ret_field = mysql_fetch_int();
   
    mysql_free_result();
    return ret_field;
}
Func MySQL_GetInt return "-1" and it should return "pieniadze" (520000$)

How to fix?
refresh..
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)