Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname="localhost";
- $db="lab8";
- $Username="user1";
- $Password="user1abc";
- $conn=new PDO("mysql:host=$hostname;dbname=$db",$Username,$Password);
- $sql= "select StudentID from students";
- try
- {
- echo "Connected successfully";
- $stmt=$conn->prepare($sql);
- $stmt->execute();
- $results=$stmt->fetchAll();
- }
- catch(Exception $ex)
- {
- echo($ex -> getMessage());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement