Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $name = $_POST['name'];
- $icNo = $_POST['icNo'];
- $company = $_POST['company'];
- $imageurl = $_POST['imageurl'];
- $user = 'username';
- $password = 'password';
- $db = 'upm';
- $host = 'localhost';
- //open connection to mysql db
- $connection = mysqli_connect($host,$user,$password,$db) or die("Error " . mysqli_error($connection));
- //fetch table rows from mysql db
- $sql = "INSERT INTO staff(name,icNo,company,imageurl) VALUES('$name','$icNo','$company', '$imageurl')";
- $result = mysqli_query($connection, $sql) or die("Error in Selecting " . mysqli_error($connection));
- if ($result){
- $response["success"] = 1;
- $response["message"] = "User details saved";
- } else {
- $response["success"] = 0;
- $response["message"] = "User details failed";
- }
- //echoing JSON response
- echo json_encode($response);
- //close the db connection
- mysqli_close($connection);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement