Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

MySQL simple information retrieving [Help]

$
0
0
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:

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>