I need to update every column base on nric and year.
I use this code read and print the entire contents of a CSV file
Expand|Select|Wrap|Line Numbers
- $row = 1;
- if (($handle = fopen("student.csv", "r")) !== FALSE) {
- while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
- $num = count($data);
- echo "<p> $num fields in line $row: <br /></p>\n";
- $row++;
- for ($c=0; $c < $num; $c++) {
- echo $data[$c] . "<br />\n";
- }
- }
- fclose($handle);
- }
i don't know, how to update every column base on nric and year in my database?
query is "INSERT INTO student (meta_aps) SELECT nric, year FROM student WHERE nric= 'this data from csv file'";--> This is correct
please give some idea.....