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.
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 ();
}
-
Answer # 1
Related articles
- php - about the compile-time terminal after applying font awesome in laravel
- php - about the multiple structure of laravel's many-to-many relations
- [php] about the relationship between the number of select statements and the reading speed
- about php zend framework flashmessenger
- php - [laravel] after setting up the auth function, the page that could be displayed until now can no longer be displayed
- php - laravel get information about the user who clicked
- php - about laravel's associative array
- php - about array curly braces
- php - i want to change a part of the wordpress template after loading it
- php - about dockerfile
- php - about the speed of data transfer
- php - i don't know how to fix "syntax error" after changing wordpress and css
- php - [mysql] use the select result of the subquery in the final select
- about php date function
- cakephp/crud: about query parameter value retrieval
- php - [laravel] about the return type of the helper function view ()
- php - about bookmark function on the web
- php - about compiling javascript code in laravel development
- php - about laravel 8x components
- php - using preg_match with the same character does not result in a partial match
Related questions
- Sort php array by value
- php : How to list categories along with subcategories and posts in WP?
- php - about pg4wp which runs wordpress with postures
- php : joining 2 MySQL tables and outputting data to a table
- php : Yii2 Problem .SQLSTATE [HY000]: General error: 1364 Field 'n_category_id' doesn't have a default value
- php : Redirecting from the page if the user data in the database does not match
- How can you display the latest articles (last 24 hours) in php? [closed]
- About PHP multi-condition search
- php : How to display information from a table in a loop (RedBean)
- php - i want to display two columns of the database
Typing error. Excuse me.
$result = $stmt->fetch ();
↓
$result = $stmh->fetch ();