MySql to IIF (PHP)

My Client use Quickbooks App and I need to import data from quickbook to PHP array so that I can add to database .

Here is the IIF File

Here is my database structure

I found this wonderful program http://php-quickbooks-iif-viewer-or-converter.soft112.com/download.html and manage to read the data and also store it.

    <?php
        $out="";
        $i=1;
            $data = file_get_contents("customers.IIF");
            $lines = split("\n", $data);
            $customers = array();
            $j = 1;

            foreach ($lines as $line) 
            {
                $endtag = strpos($line, "\t");
                $tag = substr($line, 0, $endtag);

                if ($tag=="!CUST") 
                {
                    $line = str_replace("\"", "", $line);
                    $arline = explode("\t", $line);

                    echo print_r($arline);
                    echo "<br><br>";
                } 
                elseif ($tag=="CUST") 
                {
                    $line = str_replace("\"", "", $line);
                    $arline = explode("\t", $line);

                    $name = explode(" ", $arline[19]);
                    if ( count($name) == 2 ) 
                    {
                        $fname = $name[0];
                        $lname = "'" . $name[1] . "'";
                    } 
                    else 
                    {
                        $fname = $arline[19];
                        $lname = 'NULL';
                    }

                    $i++; $j++;
                    $cli = "INSERT INTO 'bamboo_clients' ('id', 'name', 'address1', 'address2', 'city', 'province', 'country', 'postal_code', 'website', 'tax_status', 'client_notes') VALUES\n"
                         . "($i, '$arline[1]', '$arline[5]', '', '$arline[6]', '$arline[7]', 'USA', '$arline[8]', NULL, 1, NULL);\n\n";

                    $con = "INSERT INTO 'bamboo_clientcontacts' ('id', 'client_id', 'first_name', 'last_name', 'title', 'email', 'phone', 'password', 'access_level', 'supervisor', 'last_login', 'password_reset') VALUES\n"
                         . "($j, $i, '$fname', $lname, NULL, '$arline[17]', '$arline[14]', NULL, 0, NULL, NULL, NULL);\n\n";

                    $out .= $cli . $con;

                    print_r($arline);


                    // Create connection
                    $connection=mysqli_connect("localhost","root","","cakephp");

                    // Check connection
                    if (mysqli_connect_errno())
                    {
                        echo "Failed to connect to MySQL: " . mysqli_connect_error();
                    }

                    $query="INSERT INTO customers 
                            (country,company,user_id     ,mobile       ,        email,        title,cutomer_name)
                        VALUES
                            ('$arline[5]','$arline[1]','$arline[2]','$arline[14]','$arline[17]','$arline[28]','$arline[18]');";


                    print_r($query);
                    mysqli_query($connection,$query);


                    //echo $cli;
                    //echo $con;
                }
            }
            file_put_contents("bambooinvoice-customers.sql", $out);
        ?>

Above is my modifed code to read IIF. Now I need to export to IIF. Is there anyway to achieve ? I only need to export customers list .

MySQL IF() function, Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java  Access to MySQL - using the IIF() statement. Thomas Roethling. November 21, 2005 01:24PM Re: Access to MySQL - using the IIF() statement. wm.

I built a view on the SQL server of the data in the right order, then had a php cli script build a text file for me, with the .iif extension. The php wrote out the headers for the iif, with the requisite tab separations, and then the data came out of the query, and instead of a CSV format, it shoved a tab into the output as the column separator. No SDK needed.

MySQL IF() Function, I have now to work on my existing SQL queries and run in the first few problems: I have a statement that uses the IIF(Condition, True, False) in  SQL HOME SQL Intro SQL Syntax SQL Select SQL Select Distinct SQL Where SQL And, Or, Not SQL Order By SQL Insert Into SQL Null Values SQL Update SQL Delete SQL Select Top SQL Min and Max SQL Count, Avg, Sum SQL Like SQL Wildcards SQL In SQL Between SQL Aliases SQL Joins SQL Inner Join SQL Left Join SQL Right Join SQL Full Join SQL Self Join SQL

The answer is without a third party plugin or via developing your own plugin there is only the manual way for exporting IIF files from quickbooks. (https://quickbooks.intuit.com/community/Reports-and-accounting/Export-or-import-Intuit-Interchange-Format-IIF-files/m-p/203229)

Since your target is PHP, then as Palmer mentioned using the webconnect and the PHP DevKit would probably be what you are looking for.

However Mr. Palmer is not correct when implying the IIF is not approved by QB, infact they have continued to expand the use of IIF. However IIF does not seem to be the tool your actually looking to use.

MySQL :: Access to MySQL - using the IIF() statement, We currently use a PHP/MySQL quote generation system. See more: mysql iif, quickbooks import mysql, mysql quickbooks, quickbooks mysql, php mysql  Has anyone see this "iif" in php before? What is that actually? I try to search the documentation for it in php.net but I cant found any. Anyone can give a simple example of how to use this "iif"?

PHP/MySQL Quickbooks Import | PHP, (insuliplinRNeWs for DVD Enthusiastsl<fil9sc11ptink a <items> - <1'i'lf:S:-iif <1'df:​li'e!nurce="http ffwrox rnediatemple netfsitefnewst'detail php7id=15"l'>  IIF in php. April 12, operator in php which is used for IIF equivalent condition in php. The conditional operator is the “?:” (or ternary) operator.

PHP MySQL Website Programming: Problem - Design, Software Architecture & Engineering Projects for $30 - $100. Hello, I have three CSV files or alternativelly a PHP Array or MySQL tables. I have enclosed a  A Complete Guide to Installing MySQL and PHP with IIS Note: This article was written in 2015 and is in the process of being updated. It is still useful as a general guide for issues you might encounter in this type of installation.

CSV or MySQL to IIF or other solution | Engineering, Create Starting point: IIF'I-IF' Example 1::- _ I illcintiguraticin. . . Figure 3_1 0: Execute permissions: Ll The SCr-Ipts Applicatiog pool: I J Properties dialog box. The SQL IIF function is the new built-in Logical function introduced in SQL Server 2012. We can consider the SQL Server IIF as the shorthand way of writing IF Else , and CASE statements. SQL Server IIF function will accept three arguments.

Comments
  • Thanks Keith Palmer .let me try and get back to you asap.
  • Keith Palmar , my quickbook is a window app and client refused to do upgrades. He is an old guy. I want to link with Cakephp(online) and Quickbook(offline windows app) . Is that still possible ?
  • Yes - the links I posted above will work fine with CakePHP and the Windows version of QuickBooks.