I am a bloody beginner, I apologize if my mistake was too stupid.
So far I cannot get my 'taskone' entry updated. After the click on the button it should be '1' in the row for the current user.
my function
function loadDoc( user) {
console.log('aaa');
$.ajax({
url: "upper.php",
type: "POST",
data: {
'wp_users': user, 'taskeins': '1'
},
success: function(data){
alert(data);
}
});
}
my upper.php
$con=mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$current_user = get_current_user_id();
$Username = $_POST['wp_users'];
$taskeins = $_POST['taskeins'];
$sql = "UPDATE 'wp_users' SET 'taskeins' = 1 WHERE 'id' = '$current_user'";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
mysqli_close($con);
Basically the function should detect if the user has select the task. If so, 'taskeins' should get the indicator one so that it will be presented in the profile of the user.
The function gets called but that:
(function(event){loadDoc() }) is my console output. And I get a POST 500 error...
What I said - I am a total beginner. But maybe someone can help me.