I'm new to php

can someone explain this code, which is used to get the id of the user when he type the user name and password correctly:
Code: Select all
<?php
include('../includes/config.php');
$phone_no=$_GET["phone_no"];
$pw=$_GET["pw"];
$q="SELECT * FROM users WHERE phone_num='$phone_no' ";
$result = $con->query($q);
// Mysql_num_row is counting table row
$count=mysqli_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1){
$row = mysqli_fetch_assoc($result);
if ( $row['pw']== $pw){
$_SESSION['phone_no']= "phone_no";
$_SESSION['pw']= "pw";
// echo "Login Successful";
print($row['id']);
return true;
}
else {
echo "Wrong Username or Password";
return false;
}
}
else{
echo "Wrong Username or Password";
return false;
}
?>
thanks