Home>
I am studying mysql, but I don't know how to get the result after executing query with execute ();command.
I caught the net and copied the code of the corresponding part, but the expected display is not done.
(I want to display the value of the field, nicknamme, but nothing is displayed.)
Please tell me who knows who you are. Thank you in advance.

try {
               $pdo->beginTransaction ();
               $sql = "SELECT *
                        FROM customer_information
                        WHERE userid =: userid
                        AND password1 =: password;";
            print ($sql). "</br>";
            $stmh = $pdo->prepare ($sql);
            $stmh->bindValue (': userid', $_POST ['userid'], PDO :: PARAM_STR);
            $stmh->bindValue (': password', $_POST ['password'], PDO :: PARAM_STR);
            $bool = $stmh->execute ();
            if ($bool) {
                $result = $stmt->fetch ();
                echo "nickname =". $result ['nickname']. PHP_EOL;// Nothing is displayed.
            }
            / * That wasn't enough.
            while ($result = $stmt->fetch (PDO :: FETCH_ASSOC)) {
                print ($result ['nickname']. '<br>');
            }
            * /
            } catch (PDOException $Exception) {
                $pdo->rollback ();
                print "error:". $Exception->getMessage ();
            }