Ok, first of all, thanks for reading my question, I'll try and add as much information as possible. I'm currently making a leaderboard for a Garrysmod Gametype, I got an API key from the coders of the Gamemode and with that API key I can extract JSON encoded arrays using a STEAM_ID
Example: http://www.revoltgaming.com/api/?key=SENCORED_API_KEY&action=ajack_all&steamid=STEAM_0:0:5898349
If I use the code below everything works just fine:
$usr_url_everything = "http://www.revoltgaming.com/api/?key=114d788c3e40e91842f945f19c978e66&action=ajack_all&steamid=" . $_SESSION['STEAMID'];
$json_encoded = file_get_contents($usr_url_everything);
$json_decoded = json_decode($json_encoded, true);
But what I do is, when a user joins for the first time, I extract his JSON string and save it in a MySQL database:
$usr_url_everything = "http://www.revoltgaming.com/api/?key=114d788c3e40e91842f945f19c978e66&action=ajack_all&steamid=" . $_SESSION['STEAMID'];
$json_encoded = file_get_contents($usr_url_everything);
$query = "INSERT INTO vm_leaderboard (`txtUser`, `txtJson`) VALUES ('" . $_SESSION['STEAM64'] . "', '" . $json_encoded . "')";
But from the moment I try to DECODE the json string I pull from the database it just doesn't work, it return NULL. The json string I save in the database is identical as the string I get directly from the API page.
Here are the strings that get pulled from the database: http://www.ishots-cave.com/revolt_/lb_applejack.php
The string is saved as 'TEXT BLOB' in the database $leaderboard = new Database; $query = "SELECT * FROM vm_leaderboard"; $leaderboard->query($query); while ($leaderboard->nextRecord()) { // Decode his json string $json_encoded = $leaderboard->Record['txtJson']; echo $json_encoded; echo json_decode($json_encoded, true, 2);