-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path64.php
More file actions
32 lines (30 loc) · 660 Bytes
/
64.php
File metadata and controls
32 lines (30 loc) · 660 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
$dsn="mysql:host=localhost;dbname=test_db";
$db_user="root";
$db_user="";
try
{
$con=new PDO($dsn,$db_user,$db_password);
$con->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
echo "Connected";
$sql="SELECT * FROM student";
$result=$con->prepare($sql);
$result->execute();
$result->bindColumn(1,$id);
$result->bindColumn(1,$name);
$result->bindColumn(1,$roll);
$result->bindColumn(1,$address);
if($result->rowcount()>0)
{
while($row=$result->fetch(PDO::FETCH_BOUND))
{
echo "ID:".$row['id']."NAME:".$name."ROLL:".$roll."ADDRESS:".$address."<br>";
}
}
}
catch(PDOException $e)
{
echo "Connection Failed".$e->getMessage();
}
unset($result);
?>