Created
March 26, 2018 17:03
-
-
Save arif98741/04956df8055459fa06fcb2c348e0ff60 to your computer and use it in GitHub Desktop.
Get Data by id
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$con = new mysqli("localhost", "root", "password", "database"); | |
if($con) | |
{ | |
$id = "123"; | |
$sql = "select * from table where id='$id'"; | |
$stmt = $con->query($sql); | |
if($stmt) | |
{ | |
if($stmt->num_rows>0) | |
{ | |
$value = $stmt->fetch_assoc(); | |
//$value = $stmt->fetch_object(); | |
echo "Hellow ".$value['name']; | |
echo "Username ".$value['username']; | |
echo "Email ".$value['email']; | |
//regards www.phpdark.com | |
}else{ | |
echo "No Data Found"; | |
} | |
} | |
}else{ | |
echo "Failed To connect database" | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment