Jsonファイルをバラバラにして並べ替えてデータベースに送信するPHPスクリプトを作成しようとしていますが、なぜこれが起こっているのかわかりません:PHPのRAM制限を超えたというエラーが表示されていました(無制限に設定します)が、タイムアウトエラーが発生します。サーバーではなく自分のコードだと感じていますが、どこにも問題はなく、while ループは無限ループではありません。
<?php
//Set Ram Limit to Unlimited
ini_set('memory_limit', '-1');
//Improper Variables.
$tags = '';
$minTags = 1;
$value = '';
//Initialize Database Variables.
$host = 'localhost';
$username = 'icangame_dataa';
$password = '**********************************';
$dbname = 'icangame_data';
//Get Game Content
$linkFolder = $_POST['linkToFile'];
$file = '../games/'.$linkFolder.'/__metadata__.json';
$json = json_decode(file_get_contents($file), true);
//Take Apart the JSon
$width = $json['width'];
$height = $json['height'];
$author = $json['author'];
$thumbnail_url = $json['thumbnail_url'];
$description = $json['description'];
$controls = $json['controls'];
$developer = $json['developer'];
$name = $json['name'];
$developer_url = $json['developer_url'];
$tagsArray = $json['tags'];
//Process My Tags
$tagsNum = count($tagArray);
while ($minTags > $tagsNum)
{
$tagsTricky = "'.tags.'";
$minTagsTricky = "'".$minTags."'";
$value = $json[$tagsTricky[$minTags]];
$tags.=$value.' ';
$minTags++;
}
//Database Connection
$myCon = mysqli_connect($host, $username, $password, $dbname);
if (mysqli_connect_errno($myCon))
{
echo "Error Connection:".mysqli_connect_error();
}
//Checking if Item already exists.
$gameItem = mysqli_query($con,"SELECT $name FROM gameList");
if (!$gameItem == $name)
{
//Sending Data to Database.
mysqli_query($myCon, "INSERT INTO gameList (width, height, author, thumbnail_url, description, controls, developer, name, developer_url, tags)
VALUES ('$width', '$height', '$author', '$thumbnail_url', '$description', '$controls', '$developer', '$name', '$developer_url', '$tags')");
}
else
{
echo "Item ".$name." already exists! Sorry, someone beat you to it. ;c";
}
?>