MySQL not creating?
#1

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..
Reply
#2

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')
Reply
#3

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.
Reply
#4

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
Reply
#5

Put this:
Quote:

public OnGameModeInit()
{
mysql_debug(true);
}

And look in the logs what went wrong.
Reply
#6

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
Reply
#7

Do as Freddo said and use


Код:
VALUES(0, '%s', 0)
instead of
Код:
VALUES(0, \"%s\", 0)

Playin with ma' tables

Reply
#8

I have tried what he said but it still dosent save
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)