Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $user = 'root';
- $password = '';
- $database = 'prospech';
- $db_con = mysql_connect($host,$user,$password,$database);
- if ($db_con){
- echo 'Connected with MySQL';
- echo '<br />';
- } else {
- echo 'Failed to connect';
- echo '<br />';
- mysqli_connect_error();
- exit();
- }
- $sql = "SELECT * FROM student";
- $result = $db->query($sql);
- if (mysqli_num_rows($result) > 0)
- {
- while($result = mysqli_fetch_assoc())
- {
- echo "id: " . $result["id"]. " - Name: " . $result["firstname"]. " " . $result["lastname"]. "<br>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement