0

Hi ,

Hey I have a small problem.... For a certain field in database, tha values are sent from front end(JSP page) . Each individual value must be extracted and then inserted into the database.....
Before inserting, we have called a procedure which will extract each value and insert....
Moreover , it is only for the first value that we must insert. For all the remaining values , we have to update......


We are stuck up with this..... and some of the attempts we made aren't working.... :(

Can anyone give an idea as to how to implement this code................

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by nav33n
0

what we do in php is, open the csv file using fopen. Then using the filepointer of fopen, we store the csv values in an array. Then access that array. for example, (in php ie.,)

<?php
$fp = fopen("test.csv", "r"); //open the csv file
while ($contents = fgetcsv ($fp, 1000, ";")) { // fetch the contents of the csv file. ';' is the delimiter of the fields in csv file
		$name=$contents[0]; //first element of array $contents has $name	
//insert to table
$age=$contents[1]; //age is the 2nd element of array
//update the table
}
?>

Look for a similar function in jsp. (to open the file and get the contents of csv).

Hope it helps.
Naveen

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.