too long

I read database to get $doc_copy (contain links). If there's link, so copy process start and then go to mainProcess.php, but if not found link, then go to 'summary_index.php';` here's the code :

function copyDoc($link, $savePath){
    @copy($link, $savePath . basename($link));
}

while ($row = mysql_fetch_array($q)){   
    $doc_copy = $row['doc_url'];
    $copy = copyDoc($doc_copy, $savePath);
     if ($copy=== false){
        include 'summary_index.php';
    }
    else include 'mainProcess.php';
}

it's ok if there's no copy process. but when there's no copy process summary_index.php doesn't run. what' wrong? thank you very much :)

Your function does not have a return statement therefore $copy would always be false

It should be like this

function copyDoc($link, $savePath){
    return copy($link, $savePath . basename($link));
}