I would like to retrieve a specific row from database using php and mysqli.
For example:
I want to retrieve the row of data with userid =2
$userid =2;
Then I get it the user email, name, password from database using the $userid given:
include("includes/connect.php");
$user = "SELECT * FROM account WHERE user_id = $userid " ;
$query = mysqli_query ($conn, $user);
while($result = mysqli_fetch_array ($query)){
$name = $result['username'];
$password = $result['user_password'];
$email = $result['user_email'];
}
Then I would like to send the username, password and email of the userid=2 to mobile app in json.
How can I do that after that?