Do while循环适用于echo,但循环中只有一个函数循环

This code is supposed to insert 100 rows into the DB.

Yet when I run it, it loops only once, inserts one row and stops.

I replaced the function call with :

echo $keywords[4].'<br>';

It works perfectly. with no probleb

What is missing so that it will insert all rows into DB?

what should I change q add so that the code will insert all rows in the file

Here is the loop code:

do{

        //Insert row content into array.
        $keywords = preg_split("#\<(.*?)\>#", $row);

        //Insert relevant data into DB


        add_data($keywords);

        }
    else{
            // If row is irrelevant - continue to next row
            continue;
        }

}while (strpos($row, 'Closed P/L') != true);

Here is the function

function add_data($keywords)
{
    global $db;

    $ticket =$keywords[2];
    $o_time = $keywords[4];
    $type = $keywords[6];
    $size = $keywords[8];
    $item = substr($keywords[10], 0,  -1);
    $o_price = $keywords[12]; 
    $s_l = $keywords[14];
    $t_p = $keywords[16];
    $c_time = $keywords[18];
    $c_price = $keywords[20];
    $profit = $keywords[28];

    try
    {
        $sql = "
            INSERT INTO `data`
            (ticket, o_time, type, size, item, o_price, s_l, t_p, c_time, c_price, profit)
            VALUES
            (:ticket, :o_time, :type, :size, :item, :o_price, :s_l, :t_p, :c_time, :c_price, :profit)"; 


        $stmt = $db->prepare($sql);
        $stmt->bindParam('ticket', $ticket, PDO::PARAM_STR);
        $stmt->bindParam('o_time', $o_time, PDO::PARAM_STR);
        $stmt->bindParam('type', $type, PDO::PARAM_STR);
        $stmt->bindParam('size', $size, PDO::PARAM_STR);
        $stmt->bindParam('item', $item, PDO::PARAM_STR);
        $stmt->bindParam('o_price', $o_price, PDO::PARAM_STR);
        $stmt->bindParam('s_l', $s_l, PDO::PARAM_STR);
        $stmt->bindParam('t_p', $t_p, PDO::PARAM_STR);
        $stmt->bindParam('c_time', $c_time, PDO::PARAM_STR);
        $stmt->bindParam('c_price', $c_price, PDO::PARAM_STR);
        $stmt->bindParam('profit', $profit, PDO::PARAM_STR);

        $stmt->execute();

        //return true;  
    }
    catch(Exception $e)


    {
       return false;
       echo 'something is wrong. Here is the system\'s message:<br>'.$e;
    }
}