SA-MP Forums Archive
[Plugin] [REL] MySQL Plugin (Now on github!) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] [REL] MySQL Plugin (Now on github!) (/showthread.php?tid=56564)



Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 04.04.2011

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.


Re: [REL] MySQL Plugin R5 (04/09/10) - Romanius - 04.04.2011

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?


Re: [REL] MySQL Plugin R5 (04/09/10) - Calgon - 05.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - Romanius - 05.04.2011

this query from my php script and its work perfect.


Re: [REL] MySQL Plugin R5 (04/09/10) - Calgon - 05.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - Romanius - 05.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - [NoV]LaZ - 05.04.2011

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();
}



Re: [REL] MySQL Plugin R5 (04/09/10) - GaGlets(R) - 05.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - Romanius - 05.04.2011

Quote:

and try to use sscanf.

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

with sscanf variant doesn't suit me


Re: [REL] MySQL Plugin R5 (04/09/10) - zerocoolos - 05.04.2011

never mind...


Re: [REL] MySQL Plugin R5 (04/09/10) - Romanius - 05.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - Emanuelll - 06.04.2011

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..


Re: [REL] MySQL Plugin R5 (04/09/10) - Steve M. - 08.04.2011

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?


Re: [REL] MySQL Plugin R5 (04/09/10) - Asasi - 09.04.2011

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..


Re: [REL] MySQL Plugin R5 (04/09/10) - Sergei - 09.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - nemesis- - 13.04.2011

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


Re: [REL] MySQL Plugin R5 (04/09/10) - TomTroX - 13.04.2011

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?


Re: [REL] MySQL Plugin R5 (04/09/10) - b.rock - 13.04.2011

what is the limit of mysql?


Re: [REL] MySQL Plugin R5 (04/09/10) - kurta999 - 13.04.2011

Why limit ?


Re: [REL] MySQL Plugin R5 (04/09/10) - TomTroX - 14.04.2011

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..