1 回答
TA贡献1776条经验 获得超12个赞
您正在使用已弃用的 mysql_fetch 函数。使用新的
<?php
// Create connection
$con=mysqli_connect("localhost","super","super","testdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$action = "login";
$username = "Peperoncino";
$response = array();
if ($action == "login")
{
$query = "SELECT psw AS pswrd,id FROM Activities WHERE nome = 'Peperoncino' LIMIT 1";
if ($result = mysqli_query($con, $query))
{
$values = mysqli_fetch_assoc($result);
$password = $values['pswrd'];
$response["password"] = $password;
$response["message"] = "Get information from db";
}
else
{
echo mysqli_error($conn);
}
echo json_encode($response);
}
// Close connections
mysqli_close($con);
?>
- 1 回答
- 0 关注
- 271 浏览
添加回答
举报