<?php
    $userId = $_GET["userId"];
    $servername = "localhost:3306";
    $sql_username = "root";
    $sql_password = "";
    $dbname = "project";
    $sql_statement = "SELECT 
                    s.userName
                    , s.email
                    , s.firstname
                    , s.lastname
                    , s.address1
                    , s.address2
                    , s.state 
                    , s.zipCode
                    , s.phone 
                    , s.email 
                    , s.gender 
                    , s.maritalStatus 
                    , s.dateOfBirth
                    FROM project.registration s
                    WHERE s.Id = '$userId'";
    $conn = mysqli_connect($servername, $sql_username, $sql_password, $dbname);
    // Check connection
    if (!$conn) {
      die("Connection failed: " . mysqli_connect_error());
    }
    $result = mysqli_query($conn, $sql_statement);
    if (mysqli_num_rows($result) > 0) {
        $row = mysqli_fetch_assoc($result);
        // output data of each row
        foreach($row as $key => $value) {
            echo "$key: $value <br>";
        }
      } else {
        echo "0 results";
      }

?>