Have problem with php array. I'm trying to send get_headers() request with paths written into $variable array, answer I want to write into MySQL database, spent few hours already, but didn't find out how to do that. It returns only 1 result, but if echo results from array - can see for example 3 results. Please, help me somebody :)
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