'Sam', 'rno'=>'1', 'address'=>'Mumbai', 'course'=>'BCA' ), array( 'sname'=>'Alex', 'rno'=>'2', 'address'=>'Surat', 'course'=>'BCOM' ), array( 'sname'=>'Rai', 'rno'=>'3', 'address'=>'Ahmedabad', 'course'=>'BCA' ), array( 'sname'=>'Dawn', 'rno'=>'4', 'address'=>'Delhi', 'course'=>'BCOM' ) ); $str=''; $students= new simplexmlelement($str); foreach($data as $key=>$value) { $student= $students->addChild('student'); $student->addChild('name',$value['sname']); $student->addChild('rno',$value['rno']); $student->addChild('address',$value['address']); $student->addChild('Course',$value['course']); } $students->saveXML('students.xml'); echo"File created"; ?>
Document
Name Rollno Address "; foreach($stddata->student as $student) { if($student->Course==$c) { echo" $student->name $student->rno $student->address "; } } echo""; ?>
0 Comments