Hi how to write php code for this, I have file contain list of data for example
AA123_jane_G-1
AA456_oshi_K-3
AA789_pritt_P-4
I read my file using
function myfile(){
while (($data = fgetcsv($handle, 1000, "_")) !== FALSE) {
..................
........
.......
//get $student_id, $name, $class,
}
I need to get username and password using student_id from file
function getusernameandpassword($student_id){
........
.......
$result = mysql_query("SELECT student_id, username, password FROM account WHERE student_id= '".$student_id."'");
........
//get $username and $password from other remote server
....... }
after execute the both function, I want to gather all the information of that student and insert to DB
function insertDB(){
........
.......
mysql_query("INSERT INTO user_info
(student_id, username, password, name, class) VALUES ($student_id,$username,$password,$name,$class)")
........
.......
//insert all the paramater get from both function for each student to localhost DB}
My question, how I write this function in 1 script using php. How to return value and how to get the value to be input for other function