I'm new in PHP and follow this tutorial connect php webservices to android below is my code i change MySQL
to MySQLi
everywhere but still its show error:
<?php
$host="localhost"; //replace with database hostname
$username="root"; //replace with database username
$password=""; //replace with database password
$db_name="emp_info"; //replace with database name
$con=mysqli_connect("$host", "$username", "$password")or die("cannot
connect");
mysqli_select_db("$db_name")or die("cannot select DB");
$sql = "select * from emp_info";
$result = mysqli_query($sql);
$json = array();
if(mysqli_num_rows($result)){
while($row=mysqli_fetch_assoc($result)){
$json['emp_info'][]=$row;
}
}
mysqli_close($con);
echo json_encode($json);
?>