08.04.2018, 08:28
Quote:
Hello, I have a problem because I wanted to create tables 'bank' means I created it in phpmyadmin, I gave the appropriate values INT, TEXT, uid, state, nickname% i,% i,% s, but unfortunately in phpmyadmin nothing adds, does not complete the table.
so create data for the player's table after registration Код HTML:
format(query, sizeof(query), "INSERT INTO ekwipunek (`slot1nazwa`, `slot1wartosc`,`nick`) VALUES ('%s', '%d',`%s`)",brak, 0, PlayerName(playerid)); mysql_tquery(SQL_ID,query); format(query, sizeof(query), "INSERT INTO bank (`uid`, `stan`, `nick`) VALUES (`%i`,`%i`,`%s`)", pDane[playerid][UID],pDane[playerid][wBank],PlayerName(playerid)); mysql_query(SQL_ID,query); |
PHP код:
public OnGameModeInit()
{
//exemple to MySQL R41-4
SQL_ID = mysql_connect(...); // connection to the database
new Cache:result = mysql_query(SQL_ID,"CREATE TABLE IF NOT EXISTS `ekwipunek`(`slot1nazwa` varbinary(30) NOT NULL,`slot1wartosc` int(10) NOT NULL,`slot1nazwa` varbinary(30) NOT NULL) ENGINE = InnoDB CHARACTER SET=utf8");
cache_delete(result);
new Cache:result1 = mysql_query(SQL_ID,"CREATE TABLE IF NOT EXISTS `bank`(`uid` int(10) NOT NULL,`stan` int(10) NOT NULL,`nick` varbinary(24) NOT NULL) ENGINE = InnoDB CHARACTER SET=utf8");
cache_delete(result1);
return true;
}
new query[200];
format(query, sizeof(query), "INSERT INTO ekwipunek (`slot1nazwa`, `slot1wartosc`,`nick`) VALUES ('%e', '%d','%e')",brak, 0, PlayerName(playerid)); //add %e is string escape
mysql_tquery(SQL_ID,query);
new query[200];
format(query, sizeof(query), "INSERT INTO bank (`uid`, `stan`, `nick`) VALUES ('%i','%i','%e')", pDane[playerid][UID],pDane[playerid][wBank],PlayerName(playerid));//add %e is string escape
mysql_query(SQL_ID,query);