PHP配列に問題があります。$variable 配列にパスが書き込まれた get_headers() リクエストを送信しようとしています。MySQL データベースに書き込みたいと答えて、すでに数時間を費やしましたが、その方法がわかりませんでした。結果は 1 つしか返されませんが、配列からのエコー結果の場合は、たとえば 3 つの結果を確認できます。誰か助けてください:)
foreach($array_variable as $variable) {
$url = "http://".$site.$variable;
$file_headers = @get_headers($url);
if($file_headers[0] == 'HTTP/1.1 200 OK') {
$test = $url;
echo $test; //here it works fine, I can see all available results
$sql = mysql_query("INSERT INTO table (col_1, col_2) VALUES ($smthing, $test)"); //here problem is that result duplicates many-many times
}
echo $test; //but here I have problems, can see only 1 result (last one)
$sql = mysql_query("INSERT INTO table (col_1, col_2) VALUES ($smthing, $test)"); //here problem is, only 1 result goes to our database