Cupara
Well-known member
So this is where I have ended up after days of trying.
What I am doing is using JSON to gather data from another site then inserting that into the database. This will happen only once, then there will be a daily check that will check for specific updates to the data and update the entry once a day.
Here is what I have for insert new entry:
$results is the returned JSON information, $newResults is the new variable to commit to the database but not sure where I'm wrong.
Thanks
What I am doing is using JSON to gather data from another site then inserting that into the database. This will happen only once, then there will be a daily check that will check for specific updates to the data and update the entry once a day.
Here is what I have for insert new entry:
PHP:
$lastModified = str_replace("float(", "", $results['lastModified']);
$lastModified = str_replace(")", "", $lastModified);
$lastModified = $lastModified/1000-28800;
$lastModified = str_replace("float(", "", $lastModified);
$lastModified = str_replace(")", "", $lastModified);
$lastModify = $this->filter($results['lastModified'], 'int');
$battlegroup = $this->filter($results['battlegroup'], 'str');
$side = $this->filter('side', 'str');
$achievementPoints = $this->filter($results['achievementPoints'], 'int');
if ($options->xenwow_dailyCheck == 0 AND empty($guildData))
{
$newResults = \XF::em()->create('GoblinTimes\xenWoW:Info');
$db->beginTransaction();
$newResults->guild_lastModified = $lastModify;
$newResults->guild_bg = $battlegroup;
$newResults->guild_side = $side;
$newResults->guild_achievePoints = $achievementPoints;
$newResults->save();
$db->commit();
return $newResults;
} else {
if($lastModified > $guildData['guild_lastModified'] OR $results['achievementPoints'] > $guildData['guild_achievePoints'])
{
return \XF::em()->find('GoblinTimes\xenWoW:Guild', $guildData['guild_id']);
} else {
return false;
}
$results is the returned JSON information, $newResults is the new variable to commit to the database but not sure where I'm wrong.
Thanks