Jump to content

insert and update row in mysql


tobitimac

Recommended Posts

how can i make this code to insert a single, multiple and update rows in the database. The code only insert new rows in the database.

 


if (($handle = fopen('inventorylist.csv', "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
        $num = count($data);
      

                  $sql="INSERT into inventory(itemNumber,itemDesc,quantityHand,category,Whse) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]')";

                    mysql_query($sql) or die(mysql_error());

       
    }
    fclose($handle);

        }

Link to comment
https://forums.phpfreaks.com/topic/235142-insert-and-update-row-in-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.