MySQL simple information retrieving [Help]
#1

Hello, i'm new to the MySQL system in SA-MP, and since it's not very similar to PHP's MySQL, I have some syntax issues.

What I basicly want to do is take information from my MySQL database and print them out in PAWNO.

Here's my database:



Above OnGameModeInit:
Quote:

forward sqlConnection();
public sqlConnection() {
return mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS);
}

OnGameModeInit:
Quote:

new connection = sqlConnection();
printf("CONNECTION: '%i'", connection);
new Cache:result = mysql_query(connection, "SELECT username FROM player");
new playerName[MAX_PLAYER_NAME];

cache_get_value_name(0, "username", playerName, sizeof(playerName));
printf("PLAYER_NAME: '%s'", playerName);

I've tried different variations of cache_get_value and i've also tried to do it with & without sizeof().


Console prints:
Reply


Messages In This Thread
MySQL simple information retrieving [Help] - by OriginalShark - 30.06.2017, 19:35
Re: MySQL simple information retrieving [Help] - by Freedom. - 30.06.2017, 20:01
Re: MySQL simple information retrieving [Help] - by OriginalShark - 30.06.2017, 21:49
Re: MySQL simple information retrieving [Help] - by Konstantinos - 01.07.2017, 09:24
Re: MySQL simple information retrieving [Help] - by OriginalShark - 01.07.2017, 10:00
Re: MySQL simple information retrieving [Help] - by OriginalShark - 02.07.2017, 10:18

Forum Jump:


Users browsing this thread: 2 Guest(s)