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>';
}       

}


sql php codeigniter

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Introduction to Structured Query Language SQL pdf

SQL stands for Structured Query Language. SQL is a scripting language expected to store, control, and inquiry information put away in social databases. The main manifestation of SQL showed up in 1974, when a gathering in IBM built up the principal model of a social database. The primary business social database was discharged by Relational Software later turning out to be Oracle.

Welcome Back the T-SQL Debugger with SQL Complete – SQL Debugger

Debug SQL stored procedures and develop your SQL database project with dbForge SQL Complete, a new add-in for Visual Studio and SSMS. When you develop large chunks of T-SQL code with the help of the SQL Server Management Studio tool, it is essential to test the “Live” behavior of your code by making sure that each small piece of code works fine and being able to allocate any error message that may cause a failure within that code.

The Easy Guide on How to Use Subqueries in SQL Server

This article provides an outlook on various types of subqueries in SQL such as select or other T-SQL statements and caveats when using them.

Hire CodeIgniter Developer

Want to create unique, scalable web and app solutions? At **[HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io")**, Expert CodeIgniter developer works particularly for you and your project. You can **[Hire CodeIgniter...