下面的代码,如果我取消注释行工作得很好,我真的不知道,为什么它没有显示任何东西,当我包括注释行不显示结果。感谢您的时间和协助。当我包括我的注释行
我需要一定的一段代码来检查每一个电话号码进行搜索,这样它会自动更新表“备注”到过期让我知道登记已过期时间。
<?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 Uncommented:http://prntscr.com/cscsww 注:我已经添加了您提供的代码,没有错误显示。只要我评论代码块,它就可以按预期工作。 –
好吧,这不是没有输出,这显然是一些输出 – nogad