SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 24/01/2010, 08:53 PM   #31
Cr0ssFir3
Big Clucker
 
Cr0ssFir3's Avatar
 
Join Date: Oct 2007
Posts: 95
Reputation: 0
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

version 1.0.1 update ? :P
Cr0ssFir3 is offline   Reply With Quote
Old 25/01/2010, 10:34 AM   #32
Dreftas
Gangsta
 
Join Date: May 2008
Posts: 515
Reputation: 0
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

Problems again o_O
pawn Code:
new RegUserID;     
        format(query,sizeof(query),"SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1");
        mysql_query(query);
        mysql_store_result();
        mysql_fetch_row(line);     
        mysql_get_field("user_id",sql);
        RegUserID = strval(sql)+1;
        printf("NEW USER ID: %d",RegUserID);
        printf("FROM DATABASE: %s",sql);

Last user_id is 9313 so i need to get this:
Code:
NEW USER ID: 9314
FROM DATABASe: 9313
But i get this:
Code:
NEW USER ID: 1
FROM DATABASE: [here nothing]
from mysql logs:
Code:
[01/25/10 13:33:03] 'mysql_query' executed: "SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1" with result: "0".
[01/25/10 13:33:03] 'mysql_fetch_row' called with result: "9313".
and for mysql_get_field i have this:
pawn Code:
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)

Maybe this is some problems with plugin ? Because i can't login to my account too. Maybe you did some mistakes in yesterdays update ?
Dreftas is offline   Reply With Quote
Old 25/01/2010, 12:56 PM   #33
On_Top_Non_Stop
Huge Clucker
 
Join Date: Sep 2007
Posts: 289
Reputation: 2
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

This is the first time i have used MySql in sa-mp and decided to try this plugin.

Iv got as far as making the tables and storing the but thats it.

Could someone make an example login/register script using this plugin?

I'm still reading over the example in the first post but I'm not getting any further. Infact i seem to be going backwards

Thanks.
On_Top_Non_Stop is offline   Reply With Quote
Old 25/01/2010, 12:56 PM   #34
StrickenKid
Gangsta
 
Join Date: Feb 2009
Posts: 762
Reputation: 44
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

Quote:
Originally Posted by Dreft
Problems again o_O
pawn Code:
new RegUserID;     
        format(query,sizeof(query),"SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1");
        mysql_query(query);
        mysql_store_result();
        mysql_fetch_row(line);     
        mysql_get_field("user_id",sql);
        RegUserID = strval(sql)+1;
        printf("NEW USER ID: %d",RegUserID);
        printf("FROM DATABASE: %s",sql);

Last user_id is 9313 so i need to get this:
Code:
NEW USER ID: 9314
FROM DATABASe: 9313
But i get this:
Code:
NEW USER ID: 1
FROM DATABASE: [here nothing]
from mysql logs:
Code:
[01/25/10 13:33:03] 'mysql_query' executed: "SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1" with result: "0".
[01/25/10 13:33:03] 'mysql_fetch_row' called with result: "9313".
and for mysql_get_field i have this:
pawn Code:
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)

Maybe this is some problems with plugin ? Because i can't login to my account too. Maybe you did some mistakes in yesterdays update ?
You do not need to use mysql_fetch_row before you use mysql_fetch_field.

EDIT: I also forgot to say, but I had a request from MenaceX to add mysql_fetch_int(), and mysql_fetch_float().
I've added those into the plugin and they're working, and I'll upload it when I get home from school.

So with mysql_fetch_int(), you can do:

Code:
new RegUserID;		
		format(query,sizeof(query),"SELECT user_id FROM vartotojai ORDER BY user_id DESC LIMIT 0, 1");
		mysql_query(query);
		mysql_store_result();
		RegUserID = mysql_fetch_int();
which is way more efficient when dealing with single fields.

Quote:
Originally Posted by OnTop2K9
This is the first time i have used MySql in sa-mp and decided to try this plugin.

Iv got as far as making the tables and storing the but thats it.

Could someone make an example login/register script using this plugin?

I'm still reading over the example in the first post but I'm not getting any further. Infact i seem to be going backwards

Thanks.
I could make another simple example on how to make a full login/register system when I get home from school.
StrickenKid is offline   Reply With Quote
Old 25/01/2010, 01:20 PM   #35
On_Top_Non_Stop
Huge Clucker
 
Join Date: Sep 2007
Posts: 289
Reputation: 2
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

Quote:
Originally Posted by StrickenKid
I could make another simple example on how to make a full login/register system when I get home from school.
That would be awesome mate. Thanks.
On_Top_Non_Stop is offline   Reply With Quote
Old 25/01/2010, 02:30 PM   #36
dirkblok
Huge Clucker
 
Join Date: Aug 2009
Posts: 314
Reputation: 0
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

thanks man ! alot thanks !
keep on making such things man!

thanks
dirkblok is offline   Reply With Quote
Old 25/01/2010, 02:43 PM   #37
Dreftas
Gangsta
 
Join Date: May 2008
Posts: 515
Reputation: 0
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

pawn Code:
mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB,1);
    mysql_set_character_set("utf8");

As you can see I set character set to utf8, but:


EDIT: If i set character set to utf-8 then:


:/ Maybe I do something wrong ?
Dreftas is offline   Reply With Quote
Old 25/01/2010, 02:51 PM   #38
Cr0ssFir3
Big Clucker
 
Cr0ssFir3's Avatar
 
Join Date: Oct 2007
Posts: 95
Reputation: 0
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

Hi all.

I have this problem:
Quote:
Originally Posted by Rooter username
MySQL error: Failed to connect. Access denied for user 'root'@'localhost' (using password: YES).
Quote:
Originally Posted by XAMPP username
MySQL error: Failed to connect. Access denied for user 'postmaster'@'localhost' (using password: YES).
Quote:
Originally Posted by PC username
MySQL error: Failed to connect. Access denied for user 'King'@'localhost' (using password: YES).

Information
_________________________________________________

Operating System: Windows 7 Ultimate (32Bits)

Rooter: Yes (User: root | Password: None)
MySQL DB: localhost (IP: 172.0.0.1 | Name: trdm)
Program: XAMPP 1.7.3

Ports Open
TCP/UDP 80 (XAMPP PHP Port) - Useless
TCP/UDP 7777 (SA-MP Server port) - Useless

Script

pawn Code:
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "root"
#define MYSQL_PASS ""
#define MYSQL_DB  "trdm"
Cr0ssFir3 is offline   Reply With Quote
Old 25/01/2010, 03:09 PM   #39
Dreftas
Gangsta
 
Join Date: May 2008
Posts: 515
Reputation: 0
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

Also i don't find in any of downloads file libmysqlclient.so. I thought that i need to compile it myself but:

Code:
# $ apt-get install g++
# $ apt-get install mysql-client
# $ apt-get install libmysqlclient15-dev
I'm doing "yum" instead of "apt-get" because I have CentOS, and g++, mysql-client, libmysqlclient15-dev are not found
Also when I'm doing make i receive this:
Code:
[root@z14 source_1.0.1]# make
gcc -c -O3 -w -DLINUX -ISDK/amx/ SDK/amx/*.c
g++ -c -O3 -w -DLINUX -ISDK/amx/ SDK/*.cpp
g++ -c -O3 -w -DLINUX -ISDK/amx/ mysql.cpp
g++ -O2 -fshort-wchar -shared -o "mysql.so" *.o -I/usr/include/mysql/ -L/usr/lib/mysql/ -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [all] Error 1
Dreftas is offline   Reply With Quote
Old 25/01/2010, 04:55 PM   #40
SiJ
Gangsta
 
SiJ's Avatar
 
Join Date: Feb 2009
Location: Lithuania
Posts: 898
Reputation: 9
Default Re: [REL] SA:MP MySQL Plugin 1.0.1

Quote:
Originally Posted by Dreft
pawn Code:
mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB,1);
    mysql_set_character_set("utf8");

As you can see I set character set to utf8, but:


EDIT: If i set character set to utf-8 then:


:/ Maybe I do something wrong ?
It may not show you UTF-8 letters, because of your regional settings.. (On WinXP Control Panel > Date, Time, Language, and Regional Options > Regional and Language Settings > Advanced > Select Lithuania
__________________
Guess who's back...
SiJ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] [REL] MySQL Plugin (Now on github!) BlueG Plugin Development 6158 11/04/2020 08:51 AM
Best MySQL Plugin? Antonio [G-RP] Help Archive 3 10/01/2011 01:31 AM
Best MySQL plugin? DRIFT_HUNTER Help Archive 2 07/12/2010 03:43 PM
Which MySQL plugin? Whois. Help Archive 0 07/04/2010 11:55 AM
Mysql Plugin Help Jbosh123 Help Archive 0 04/09/2009 11:35 AM


All times are GMT. The time now is 12:04 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.