Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- $servername = "localhost";
- $username="root";
- $password="";
- $dbname="name";
- // Create connection
- $conn=new mysqli($servername,$username,$password,$dbname);
- // check connection
- if($conn->connect_error){
- die("Connection Failed" .$conn->connection_error);
- }
- $sql="SELECT student_code,name,age FROM student";
- $result=$conn->query($sql);
- if($result->num_rows >0)
- {
- //output data of each row
- while($row=$result->fetch_assoc()){
- echo "student code:".$row["student_code"]."-<br>name:".$row["name"]."<br>age".$row["age"]."<br><br><br>";
- }
- }else{
- echo "0 results";
- }
- $conn->close();
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment