Blog > September 2011

Launch: L.V. Harkness "Personalize Your Stationery" Web Application

September 2011

We recently completed a new custom web application for LV Harkness & Co.. The application allows customers to personalize their own stationery in real-time at www.lvharkness.com/stationery. Customers are able to choose from a variety of custom fonts, monograms and colors. The back-end management area allows LVH staff to easily control all aspects of the application. We built this completely custom application using jQuery, PHP & MySQL.

Click here to view a demo.
(You won't be able to add the demo stationery to your cart)

Tutorial: Import a CSV File Using PHP and MySQL

September 2011

The following code should help beginner PHP/MySQL developers who are looking for an easy way to import a CSV or comma delimited file into a mysql database.  This example adds new contacts into the contacts table from an uploaded CSV file, populating the following three fields: (contact_first, contact_last, contact_email).

Click to view files:

I've included the PHP code below that 'does all the work'.  Click the 'import.php' link above to view the full code.

    //get the csv file
    $file = $_FILES[csv][tmp_name];
    $handle = fopen($file,"r");
   
    //loop through the csv file and insert into database
    do {
        if ($data[0]) {
            mysql_query("INSERT INTO contacts_tmp (contact_first, contact_last, contact_email) VALUES
                (
                    '".addslashes($data[0])."',
                    '".addslashes($data[1])."',
                    '".addslashes($data[2])."'
                )
            ");
        }
    } while ($data = fgetcsv($handle,1000,",","'"));
    //