Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +----+---------+
- | ID | File |
- +----+---------+
- | 01 | abc.jpg |
- | 02 | cde.mp3 |
- | 03 | efg.doc |
- +----+---------+
- $sql = "SELECT id,file FROM `test’ ”;
- if($stmt=$conn->prepare($sql)){
- $stmt->execute();
- $stmt->bind_result($id, $file);
- $array= array();
- while ($stmt->fetch()) {
- $array[]= array('id' =>$id ,’path'=>'http:// abc.com/file/'.$file);
- }
- $json=json_encode($array,JSON_UNESCAPED_UNICODE);
- }
- print_r($json);
- }
- else {
- };
- [{"id": "01", "path": "http:// abc.com/file/abc.jpg"},
- {"id": "02", "path": "http:// abc.com/file/cde.mp3"},
- {"id": "03", "path": "http:// abc.com/file/efg.doc"}]
- res.json({"Error" : false, "Message" : "Success", "Users" : rows}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement