コメント行のコメントを外すと、以下のコードはうまく動作しますが、コメント行を含めると何も表示されない理由はわかりません。あなたの時間と援助をありがとう。私のコメント行を含めると結果は表示されません
電話番号が検索されるたびにチェックするコードが必要です。自動的にテーブル「ノート」が期限切れに更新され、登録が既に期限切れになっていることがわかります。
<?php
include_once('assets/inc/db_login.inc');
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(empty($_POST["phone"])) {
$unameErr = "Phone is required";
}
else {
$phone = clean_input($_POST["phone"]);
}
}
$check = sql_entry($phone);
/* Functions */
function clean_input($login){
$login = trim($login);
$login = stripslashes($login);
$login = htmlspecialchars($login);
return $login;
}
function sql_entry($phone){
//do not touch anything beyond this part
$conn = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_NAME);
//error catcher for connection failure
if($conn->connect_error){
die("Connection failed: " . $conn->connect_error);
}
//clean themmmmmm!
$clean_phone = mysqli_real_escape_string($conn, $phone);
//prepare queries
$verification = "SELECT * FROM ".DB_TBL." WHERE phone = ".$clean_phone;
$verification_result = mysqli_query($conn,$verification); //run query to validate phone number
/*
$row = mysqli_fetch_array($verification_result, MYSQLI_ASSOC);
$startdate = $row['register_date'];
$expire = strtotime($startdate. ' + 182 days');
$today = strtotime("today midnight");
if($today >= $expire){
$update = "UPDATE ".DB_TBL." SET notes='Expired' WHERE phone = ".$clean_phone;
$run_update = mysqli_query($conn,$update);
}
*/
return $verification_result;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> - | User Registration</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<center><br>
<br>
<br>
<br>
<br>
<br>
<table width="500", cellpadding=5 callspacing=5 border=1>
<tr>
<th>Name</th>
<th>Register Date</th>
<th>Phone</th>
<th>Points</th>
<th>Note</th>
</tr>
<?php while($rows = mysqli_fetch_array($check, MYSQLI_ASSOC)): ?>
<tr>
<td><?php echo $rows['username']; ?></td>
<td><?php echo $rows['register_date']; ?></td>
<td><?php echo $rows['phone']; ?></td>
<td><?php echo $rows['points']; ?></td>
<td><?php echo $rows['notes']; ?></td>
</tr>
<?php endwhile; ?>
</table>
</center>
</body>
</html>
死の白い画面:エラーチェック\表示がオフで、エラーを表示するにはそれらをオンにします。 PHPページの最上部に次の行を追加します: 'ini_set( 'display_errors'、 'On'); ini_set( 'html_errors'、0); error_reporting(-1); ' – nogad
こんにちは、それは私がコメントしたコードのブロックをコメント解除すると、私は完璧に実行されます、それはもう何も出力を表示しません。 コメント:http://prntscr.com/cscsov コメントを外してください:http://prntscr.com/cscsww 注:既に提供しているコードを追加しました。エラー表示はありません。コードブロックにコメントする限り、意図したとおりに動作します。 –
ok出力は出力されません。出力は明らかです。 – nogad