Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Getting the requested id
- $id = $_GET['id'];
- //Importing database
- require_once('dbConnect.php');
- //Creating sql query with where clause to get an specific employee
- $sql = "SELECT * FROM persons WHERE firstName = '$firstName' AND lastName = '$lastName' AND company = '$company';
- //getting result
- $r = mysqli_query($con,$sql);
- //pushing result to an array
- $result = array();
- $row = mysqli_fetch_array($r);
- array_push($result,array(
- "id"=>$row[id],
- "firstName"=>$row[firstName],
- "lastName"=>$row[lastName],
- "company"=>$row[company]
- ));
- //displaying in json format
- echo json_encode(array('result'=>$result));
- mysqli_close($con);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement