tobitimac Posted April 30, 2011 Share Posted April 30, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.