24.01.2010, 17:49
Quote:
Originally Posted by Dreft
Ok, i turned off mysql_log() which was printing that all row and crash gone
![]() Thanks for plugin again, it will change old G-Stylezz plugin for sure ![]() |
Originally Posted by Dreft
Ok, i turned off mysql_log() which was printing that all row and crash gone
![]() Thanks for plugin again, it will change old G-Stylezz plugin for sure ![]() |
stock ConfigRace()
{
new CpCfgStr[4][56];
sInfo[MaxRaces] = -1;
for(new cfg = 0; cfg < 50; cfg++)
{
format(query,sizeof(query),"SELECT * FROM races WHERE raceid = %d",cfg);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
mysql_fetch_row(line);
mysql_get_field("name",sql);
format(rInfo[cfg][Name],128,"%s",sql);
mysql_get_field("minx",sql);
rInfo[cfg][minX] = floatstr(sql);
mysql_get_field("maxx",sql);
rInfo[cfg][maxX] = floatstr(sql);
mysql_get_field("miny",sql);
rInfo[cfg][minY] = floatstr(sql);
mysql_get_field("maxy",sql);
rInfo[cfg][maxY] = floatstr(sql);
mysql_get_field("Z", sql);
rInfo[cfg][spawnZ] = floatstr(sql);
for(new ccfg = 1; ccfg < 26; ccfg++)
{
format(CpCfgStr[0],56,"cp%d_x",ccfg);
format(CpCfgStr[1],56,"cp%d_y",ccfg);
format(CpCfgStr[2],56,"cp%d_z",ccfg);
format(CpCfgStr[3],56,"cp%d_param",ccfg);
mysql_get_field(CpCfgStr[0], sql);
rCP[cfg][ccfg][Xr] = floatstr(sql);
mysql_get_field(CpCfgStr[1], sql);
rCP[cfg][ccfg][Yr] = floatstr(sql);
mysql_get_field(CpCfgStr[2], sql);
rCP[cfg][ccfg][Zr] = floatstr(sql);
mysql_get_field(CpCfgStr[3], rCP[cfg][ccfg][option]);
}
sInfo[MaxRaces]++;
}
mysql_free_result();
}
return 1;
}
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
Originally Posted by MenaceX^
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
What's that for? |
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);
NEW USER ID: 9314 FROM DATABASe: 9313
NEW USER ID: 1 FROM DATABASE: [here nothing]
[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".
#define mysql_get_field(%1,%2) mysql_fetch_field(%1,%2)
Originally Posted by Dreft
Problems again o_O
pawn Code:
Code:
NEW USER ID: 9314 FROM DATABASe: 9313 Code:
NEW USER ID: 1 FROM DATABASE: [here nothing] 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". 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(); RegUserID = mysql_fetch_int();
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. |
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.
|
mysql_connect(SQL_HOST,SQL_USER,SQL_PASS,SQL_DB,1);
mysql_set_character_set("utf8");
Originally Posted by Rooter username
MySQL error: Failed to connect. Access denied for user 'root'@'localhost' (using password: YES).
|
Originally Posted by XAMPP username
MySQL error: Failed to connect. Access denied for user 'postmaster'@'localhost' (using password: YES).
|
Originally Posted by PC username
MySQL error: Failed to connect. Access denied for user 'King'@'localhost' (using password: YES).
|
#define MYSQL_HOST "127.0.0.1"
#define MYSQL_USER "root"
#define MYSQL_PASS ""
#define MYSQL_DB "trdm"
# $ apt-get install g++ # $ apt-get install mysql-client # $ apt-get install libmysqlclient15-dev
[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
Originally Posted by Dreft
pawn Code:
![]() EDIT: If i set character set to utf-8 then: :/ Maybe I do something wrong ? |