Code of index_webservice.php file is below
<?php $conn =new mysqli('localhost', 'root', '' , 'suman'); $sql = "SELECT id,name,email FROM student"; $result = $conn->query($sql); $i=0; while($arr = $result -> fetch_array()) { $arr_new[$i]['id']=$arr['id']; $arr_new[$i]['name']=$arr['name']; $arr_new[$i]['email']=$arr['email']; $i++; } $result -> free_result(); $conn->close(); echo json_encode(array('data'=>$arr_new)); ?>
Manipulate database table and create a array.Then pass it into json_encode() function.You are one the way!
url: http://localhost/suman/index_webservice.php