<?php
if (isset($_POST['import'])) {
    $fname = $_FILES['patientcsv']['name'];
    echo 'upload file name: ' . $fname . ' ';
    $chk_ext = explode(".", $fname);
    if (strtolower(end($chk_ext)) == "csv") {
        $filename = $_FILES['patientcsv']['tmp_name'];  
        $handle = fopen($filename, "r");
        $i = 0;
        mysql_query("START TRANSACTION");
        while (($data = fgetcsv($handle, filesize($fname), ",")) !== FALSE) {
            if ($i > 0) {
                $docant = (addslashes($data[35]) != '' ) ? addslashes($data[35]) : addslashes($data[11]);
                $sqlquery = mysql_query("SELECT RecdNo FROM patient WHERE RecdNo='" . $data[0] . "'");
                if (mysql_num_rows($sqlquery) > 0) {
                    $query = mysql_query("UPDATE  patient SET  
                        `price` =  '" . addslashes($data[1]) . "',
                        `ffpostleft` =  '" . addslashes($data[2]) . "',
                        `ffpostright` =  '" . addslashes($data[3]) . "',
                        `ffdefright` =  '" . addslashes($data[4]) . "',
                        `ffdefleft` =  '" . addslashes($data[5]) . "',
                        `rfpright` =  '" . addslashes($data[6]) . "',
                        `rfpleft` =  '" . addslashes($data[7]) . "',
                        `ffposting` =  '" . addslashes($data[8]) . "',
                        `OrthoType` =  '" . addslashes($data[9]) . "',
                        `Dateshiped` = '" . date('Y-m-d', strtotime(str_replace('/', '-', $data[10]))) . "',
                        `Practioner` =  '" . addslashes($data[11]) . "',
                        `W_ONumber` =  '" . addslashes($data[12]) . "',
                        `FirstName` =  '" . addslashes($data[13]) . "',
                        `LastName` =  '" . addslashes($data[14]) . "' ,
                        `comments` =  '" . addslashes($data[15]) . "',
                        `duedate` = '" . date('Y-m-d', strtotime(str_replace('/', '-', $data[16]))) . "',
                        `matthk` =  '" . addslashes($data[17]) . "',
                        `covers` =  '" . addslashes($data[18]) . "',
                        `cia` =  '" . addslashes($data[19]) . "',
                        `buildup` =  '" . addslashes($data[20]) . "',
                        `rush` =  '" . addslashes($data[21]) . "',
                        `covers1` =  '" . addslashes($data[22]) . "',
                        `covers2` =  '" . addslashes($data[23]) . "',
                        `covers3` =  '" . addslashes($data[24]) . "',
                        `covers4` =  '" . addslashes($data[25]) . "',
                        `grind` =  '" . addslashes($data[26]) . "',
                        `Completed` =  '" . addslashes($data[27]) . "',
                        `Invioce` =  '" . addslashes($data[28]) . "', 
                        `grind2` =  '" . addslashes($data[29]) . "',
                        `WorkOrder` =  '" . addslashes($data[30]) . "',
                        `totprice` =  '" . addslashes($data[31]) . "',
                        `rfplt` =  '" . addslashes($data[32]) . "',
                        `rfprt` =  '" . addslashes($data[33]) . "',
                        `RecordCount` =  '" . addslashes($data[34]) . "',
                        `docacnt` =  '" . addslashes($data[35]) . "',
                        `InvoiceNum` =  '" . addslashes($data[36]) . "',
                        `InvoiceDate` = '" . date('Y-m-d', strtotime(str_replace('/', '-', $data[37]))) . "',
                        `Discounted` =  '" . addslashes($data[38]) . "',
                        `OLabelName` =  '" . addslashes($data[39]) . "',
                        `FullPrice` =  '" . addslashes($data[40]) . "',
                        `AcceptDefault` =  '" . addslashes($data[41]) . "',
                        `Inspected` =  '" . addslashes($data[42]) . "',
                        `TotalCost` =  '" . addslashes($data[43]) . "'WHERE  RecdNo ='" . addslashes($data[0]) . "'");
                } else {
                    $query = mysql_query("INSERT IGNORE INTO  
            patient (RecdNo,price,ffpostleft,ffpostright,ffdefright,ffdefleft,rfpright,rfpleft,ffposting,OrthoType,Dateshiped,Practioner,
            W_ONumber,FirstName,LastName,comments,duedate,matthk,covers,
            cia,buildup,rush,covers1,covers2,covers3,covers4,grind,Completed,Invioce,grind2,WorkOrder,totprice,rfplt,rfprt,RecordCount,
            docacnt,InvoiceNum,InvoiceDate,Discounted,OLabelName,FullPrice,AcceptDefault,Inspected,TotalCost) VALUES 
                        ( 
                        '" . addslashes($data[0]) . "', 
                        '" . addslashes($data[1]) . "', 
                        '" . addslashes($data[2]) . "',
                        '" . addslashes($data[3]) . "',
                        '" . addslashes($data[4]) . "',
                        '" . addslashes($data[5]) . "',
                        '" . addslashes($data[6]) . "',
                        '" . addslashes($data[7]) . "',
                        '" . addslashes($data[8]) . "',
                        '" . addslashes($data[9]) . "',
                        '" . date('Y-m-d', strtotime(str_replace('/', '-', $data[10]))) . "',
                        '" . addslashes($data[11]) . "',
                        '" . addslashes($data[12]) . "',
                        '" . addslashes($data[13]) . "',
                        '" . addslashes($data[14]) . "',
                        '" . addslashes($data[15]) . "',
                        '" . date('Y-m-d', strtotime(str_replace('/', '-', $data[16]))) . "',
                        '" . addslashes($data[17]) . "',
                        '" . addslashes($data[18]) . "',
                        '" . addslashes($data[19]) . "',
                        '" . addslashes($data[20]) . "',
                        '" . addslashes($data[21]) . "',
                        '" . addslashes($data[22]) . "',
                        '" . addslashes($data[23]) . "',
                        '" . addslashes($data[24]) . "',
                        '" . addslashes($data[25]) . "',
                        '" . addslashes($data[26]) . "',
                        '" . addslashes($data[27]) . "',
                        '" . addslashes($data[28]) . "',
                        '" . addslashes($data[29]) . "',
                        '" . addslashes($data[30]) . "',
                        '" . addslashes($data[31]) . "',
                        '" . addslashes($data[32]) . "',
                        '" . addslashes($data[33]) . "',
                        '" . addslashes($data[34]) . "',
                        '" . $docant . "',
                        '" . addslashes($data[36]) . "',
                        '" . date('Y-m-d', strtotime(str_replace('/', '-', $data[37]))) . "',
                        '" . addslashes($data[38]) . "',
                        '" . addslashes($data[39]) . "',
                        '" . addslashes($data[40]) . "',
                        '" . addslashes($data[41]) . "',
                        '" . addslashes($data[42]) . "',
                        '" . addslashes($data[43]) . "'
                        ) 
                    ");
                }
            }
            $i++;
        }
        mysql_query("COMMIT");
        mysql_query("ROLLBACK");
        fclose($handle);

        $msg = $i.' rows Successfully Impoted';
    } else {
        $msg = 'Your Impoted data is wrong';
    }
}
?>

Seeing as you're inserting or updating one row at a time simply include to variables, one for updated, one for inserted, and increment each other the respective database operation.
Once, you're done you have your two totals.
If the update could affect more than one row in the database, the update command returns the number of rows affected so catch the return in a variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.