###実現したいこと
ユーザ登録成功した際に"登録が完了しました。あなたのユーザ名は${name}で、パスワードは${pass}です"
を表示させたいです
###発生している問題
画面が真っ白で何も表示されない
###試してみたこと
判定処理を何度か書き換えてみましたが、メッセージが表示されませんでした
登録処理ではエラーは起きていません
該当のコード
php
1<?php 2require_once('db_connection.php'); 3 4class User_registaration extends Db_Connection 5{ 6 public function __construct() 7 { 8 parent::__construct(); 9 } 10 11 //ユーザ情報登録 12 public function user_registaration($name, $pass) 13 { 14 /*if(!isset($error)) 15 {*/ 16 //登録処理 17 $sql = "INSERT INTO ip_d_user_information(infouser_user_name, infouser_password) VALUES (?, ?)"; 18 $stmt = $this->link->prepare($sql); 19 $stmt->execute(array($name, password_hash($pass, PASSWORD_DEFAULT))); 20 21 //判定処理 22 $sql = "SELECT * FROM ip_d_user_information ORDER BY DESC LIMIT 1"; 23 $stmt = $this->link->query($sql); 24 $data = $stmt->fetch(PDO::FETCH_ASSOC); 25 if($name == $data['infouser_user_name'] && $pass == $data['infouser_password']) 26 { 27 $success = "登録が完了しました。あなたのユーザ名は${name}で、パスワードは${pass}です"; 28 return $success; 29 } 30 } 31} 32 33$username = $_POST["username"]; 34$password = $_POST["password"]; 35$password2 = $_POST["password2"]; 36 37$user = new User_registaration; 38 39$success = $user->user_registaration($username, $password);
###追記のコード
php
1<?php 2 3require_once('Smarty.class.php'); 4require_once('../file_class/login_authentication.php'); 5require_once('../file_class/user_registration.php'); 6 7$smarty = new Smarty(); 8 9$smarty->template_dir = '../templates'; 10$smarty->compile_dir = '../templates_c'; 11$smarty->config_dir = '../configs/'; 12$smarty->cache_dir = '../cache/'; 13 14session_start(); 15 16// メッセージの初期化 17$errorMessage = ""; 18$signUpMessage = ""; 19 20$smarty->assign('signUpMessage', $success); 21 22$smarty->display('signup.tpl');
〈画面が真っ白で何も表示されない〉エラーログにエラーメッセージなど残っていないかを点検するのが先。
回答3件
あなたの回答
tips
プレビュー