Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //MySQL Insert Data
- $host = 'localhost';
- $user = 'root';
- $password = 'root';
- $db_name = 'basicDB_2';
- //students_2
- $mysql_conn = mysqli_connect( $host, $user, $password, $db_name );
- if ( !$mysql_conn ) {
- die( "Connection Failed" . mysqli_connect_error() );
- }
- $sql = "SELECT id, firstname, lastname, email FROM students_2 ORDER BY id";
- $result = mysqli_query( $mysql_conn, $sql );
- //print_r( $result );
- $rows = mysqli_num_rows( $result );
- if ( $rows > 0 ) {
- while ( $row = mysqli_fetch_assoc( $result ) ) {
- echo "id=" . $row["id"] . " Name - " . $row["firstname"] . " " . $row["lastname"] . " - Email - " . $row["email"] . "<br>";
- }
- }
- mysqli_close( $mysql_conn );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement