[MySQL] Samp_mysql_getfield Crashes Server - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [MySQL] Samp_mysql_getfield Crashes Server (
/showthread.php?tid=69766)
[MySQL] Samp_mysql_getfield Crashes Server -
tom_jonez - 20.03.2009
Код:
format(query,256,"SELECT * FROM `users` WHERE `username`='%s' AND `password`='%s'",playername,phash);
samp_mysql_query(query);
samp_mysql_store_result();
new rows = samp_mysql_num_rows();
if(rows != 1) return SendClientMessage(playerid,COLOR_RED,"Invalid Login - Please try again.");
SendClientMessage(playerid,COLOR_LIME,"You have successfully logged in!");
new fieldvalue[128];
new field[128];
new line[1024];
samp_mysql_fetch_row(line);
samp_mysql_get_field("username", fieldvalue);
printf("%s ", fieldvalue);
samp_mysql_get_field("money", fieldvalue);
printf("%% ", fieldvalue);
The first "username" field gets printed into the cmd prompt, but then the second just crashes the server.
there arent any compiling errors, but when i /login (this is the /login code), the server crashes.
Please help!
Re: [MySQL] Samp_mysql_getfield Crashes Server -
tom_jonez - 20.03.2009
server log:
Код:
[17:26:51] Incomming connection: 71.238.180.253:13132
[17:26:51] [join] R4nk3d has joined the server (0:71.238.180.253)
[17:26:57] AmxLoad
[17:26:57] xStreamer: xStreamer filterscript has been detected
[17:26:57] Filterscript 'xstreamer.amx' loaded.
[17:27:04] R4nk3d
it prints R4nk3d(username), but then after that crashes =/