-
Notifications
You must be signed in to change notification settings - Fork 0
/
addNewPlayer.php
26 lines (21 loc) · 1009 Bytes
/
addNewPlayer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
include './includes/dbconfig.php';
$firstname = !empty($_POST['firstname']) ? $_POST['firstname'] : '';
$lastname = !empty($_POST['lastname']) ? $_POST['lastname'] : '';
$mname = !empty($_POST['mname']) ? $_POST['mname'] : '';
$bdate = !empty($_POST['bdate']) ? $_POST['bdate'] : '';
$sex = !empty($_POST['emodel']) ? $_POST['emodel'] : '';
$rating = !empty($_POST['rating']) ? $_POST['rating'] : '';
$email = !empty($_POST['email']) ? $_POST['email'] : '';
$usatt = !empty($_POST['usatt']) ? $_POST['usatt'] : '';
$query = mysqli_query($con, 'INSERT INTO users (member_id, fname,lname,mname,sex,rating,email)
VALUES ("' . $usatt . '","' . $firstname . '","' . $lastname . '","'.$mname.'","'.$sex.'","'.$rating.'","'.$email.'")');
if($query){
echo json_encode(array('error' => 'false', 'msg' => 'New Player Added Successfully'));
die();
}
else{
echo json_encode(array('error' => 'true', 'msg' => 'Doh! Something went wrong.'));
die();
}
?>