when user clicks button shows datbase value with that id php code example

Example: when user clicks button shows datbase value with that id php

<?Php
require "config.php"; // database connection details 
$str=$_GET['str']; // collect the student id

$count=$dbo->prepare("select * from student where id=:id");
$count->bindParam(":id",$str,PDO::PARAM_INT,3);

if($count->execute()){
$row = $count->fetch(PDO::FETCH_OBJ);
echo "id: ".$row->id.", Name: ".$row->name." , Mark : ",$row->mark;
}else{
echo "Database Problem ";
}

?>

Tags:

Php Example