MySQL not creating? - 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 not creating? (
/showthread.php?tid=148814)
MySQL not creating? -
NewTorran - 19.05.2010
pawn Код:
public OnPlayerConnect(playerid)
{
format(query, sizeof(query), "SELECT `userid` FROM `users` WHERE `username` = '%s'", GetName(playerid));
samp_mysql_query(query);
samp_mysql_store_result();
if(samp_mysql_num_rows() == 0)
{
format(query, sizeof(query), "INSERT INTO `users` (userid, username, money) VALUES(0, \"%s\", 0)", GetName(playerid));
samp_mysql_query(query);
}
else
{
format(query, sizeof(query), "SELECT * FROM `users` WHERE `username` = '%s'", GetName(playerid));
samp_mysql_query(query);
samp_mysql_store_result();
samp_mysql_fetch_row(result);
}
return 1;
}
When i connect to my server and check my database there isent anything there?
Its not creating it, Why is that? Im a real real real REAL beginner at MySQL on SAMP so if im doing it completely wrong then..
Re: MySQL not creating? -
Calgon - 19.05.2010
pawn Код:
INSERT INTO `users` (userid, username, money) VALUES(0, \"%s\", 0)
You need to continue using the `'s for field/rows or don't bother using them all.
pawn Код:
INSERT INTO `users` (`userid`, `username`, `money`) VALUES('0', '%s', '0')
Re: MySQL not creating? -
Burridge - 19.05.2010
Might I suggest that you don't use [RAZ]ADreNaLiNe-DJ's plugin. It's bugged to hell. Use G-sTyLeZzZ's, or StrickenKid's.
Re: MySQL not creating? -
NewTorran - 19.05.2010
Quote:
Originally Posted by [UF
XtreaMeR ]
Might I suggest that you don't use [RAZ]ADreNaLiNe-DJ's plugin. It's bugged to hell. Use G-sTyLeZzZ's, or StrickenKid's.
|
I cannot get them ones to work
Re: MySQL not creating? - WackoX - 19.05.2010
Put this:
Quote:
public OnGameModeInit()
{
mysql_debug(true);
}
|
And look in the logs what went wrong.
Re: MySQL not creating? -
NewTorran - 19.05.2010
Quote:
Originally Posted by WackoX
Put this:
Quote:
public OnGameModeInit()
{
mysql_debug(true);
}
|
And look in the logs what went wrong.
|
I dont have that in my include
Re: MySQL not creating? -
Joe Staff - 19.05.2010
Do as Freddo said and use
instead of
Код:
VALUES(0, \"%s\", 0)
Playin with ma' tables
Re: MySQL not creating? -
NewTorran - 19.05.2010
I have tried what he said but it still dosent save
Re: MySQL not creating? -
NewTorran - 19.05.2010
I have found the problem!
OnPlayerConnect or OnPlayerDisconnect
ARENT being called
I mean this explains so much. Why my dialogs dont show ect,
But anyway why arent they being called? Anyone help? Ty