my php code is:
$query = "SELECT * FROM users WHERE user='admin' AND password='MTIz'";
$result = $link->query($query);
$yes = array();
$yes[] = $result->num_rows;
echo json_encode($yes);
And my HTML code is:
$.ajax({
url: 'vlogin.php',
type: 'POST',
data: myData,
dataType: 'json',
contentType: "application/json; charset=utf-8",
success: function(yes) {
alert(yes.Result);}
});
Not return anything. What appens? Thanks
contentType$yes['Result'] = $result->num_rows;console.log(yes)to see exactly what's inside your response$link? What is$result->num_rowssupposed to contain? Is it an object? Is it an integer? Where do you define theResultindex? When writing$yes = array(); $yes[] = $result->num_rows;you won't have any$yes['Result']but a$yes[0]['Result']