How to convert and insert string value 9,999.99 to float/double in sql using php

How to convert and insert string value 9,999.99 to float/double in sql using php

I have arrays of data (import from excel) values in string. One of the data are accounting numbers eg: 9,999.99

I have arrays of data (import from excel) values in string. One of the data are accounting numbers eg: 9,999.99

my sql data type for that accounting numbers is float. each time I insert the value.. it only store 9 instead 9,999.99 And I plan to store in format 9999.99 (without the comma)

I cannot change the sql data type to string as it will be use for calculations later on.. so how do i convert and store the data?

appreciate your suggestions. Thanks

This is my code to insert into DB

// To set HMS daily collection
function set_pbb_data($sheetDataPBB)
{
    $OK = 0;
    $notOK = 0;
    $firstElement = true;

foreach ($sheetDataPBB as $value)
{
    if ($firstElement) {
        $firstElement = false;  
    }
    else {
        $dbEntry = array(
        'sett_date'     => $value[0],
        'trans_date'    => $value[1],
        'card_no'       => $value[2],
        'card_type'     => $value[3],
        'trans_curr'    => $value[4],
        'trans_amt'     => $value[5],
        'sett_curr'     => $value[6],
        'sett_amt'      => $value[7],
        'gross_cur'     => $value[8],
        'gross_amt'     => $value[9],
        'mdr'           => $value[10],
        'mid'           => $value[11],
        'approval_code' => $value[12],
        'status'        => $value[13],
        'tid'           => $value[14],
        'batch_no'      => $value[15],
        'dba'           => $value[16],
        'trace_no'      => $value[17],
        'prod_type'     => $value[18]
        );
        if ($value[0] != null){ 
            $this->db->insert('pbb_cc_tbl', $dbEntry);
            if ($this->db->affected_rows() > 0) {
                $OK++;
            }
            else {  
                echo '<script>alert(" '.$value[0].' Already Exist!");</script>';
                $notOK++;
            }   
        }           
    } //end-if
} //end-foreach

if ($this->db->affected_rows() > 0) {
    echo '<script>alert("'.$OK.' PBB Data Added Successfully");  </script>';
}
else {  
    echo '<script>alert("'.$notOK.' PBB Data Already Exist!"); window.history.back();</script>';
}       

}


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Building PHP apps using SQL Server on Windows

3 step: Building PHP apps using SQL Server on Windows

PHP Interview Questions with Solutions: Prepare for PHP Interview

Prepare for PHP Interviews. Set Variable With php.ini File. Logic & Output Behind PHP Code Segment. Class Concept, Error & Functions in PHP. Start PHP Now!

PHP Web Application Development Company

As a top **PHP Web Application Development Company in USA**[https://www.dataeximit.com/php-development-services/](https://www.dataeximit.com/php-development-services/ "https://www.dataeximit.com/php-development-services/"), we at Data EximIT have...