在php中,如果数据库中列的值为null,则隐藏特定行
嗨,我正在从sql表中获取数据。如果没有条件,则所有数据都正确提取,但如果数据库中的“间隙金额”列值为空,则在提取数据并在前端显示间隙金额行时,应隐藏间隙金额行,如果间隙金额的值为空,则不应在前端显示间隙金额行在php中,如果数据库中列的值为null,则隐藏特定行,php,mysql,Php,Mysql,嗨,我正在从sql表中获取数据。如果没有条件,则所有数据都正确提取,但如果数据库中的“间隙金额”列值为空,则在提取数据并在前端显示间隙金额行时,应隐藏间隙金额行,如果间隙金额的值为空,则不应在前端显示间隙金额行 if(mysqli_num_rows($result) < 0) { echo 'Your Application status is pending from ADMIN'; } else { $querys = " SELECT * FROM user
if(mysqli_num_rows($result) < 0)
{
echo 'Your Application status is pending from ADMIN';
}
else
{
$querys = "
SELECT *
FROM users
WHERE username = '$_SESSION[user]'
AND user_password = '$_SESSION[password]'
AND enrollment_fee_amounts !=''
AND bci_collection_funds!=''
";
$results = mysqli_query($conn, $querys);
if(mysqli_num_rows($results) > 0){
$output .= '
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>S.No</th>
<th>Payment Category</th>
<th>Account Name</th>
<th>Account No</th>
<th>Amount</th>
<th>Download Challan</th>
</tr>
</thead>
';
while($rows = mysqli_fetch_array($results))
{
$output .= '
<tr class="cha">
<td>1</td>
<td>Application Fee & Stamp Duty</td>
<td>' . $rows['application_fee_account_name'].'</td>
<td>' . $rows['application_fee_account_number'].'</td>
<td>' . $rows['application_fee_amount'].'</td>
<td><a class="buttons edit" href="generate.php?id=' .$rows['users_id'] .'">VIEW</a></td>
</tr>
<tr class="cha">
<td>4</td>
<td>Library Fund</td>
<td>' . $rows['library_fund_account_name'].'</td>
<td>' . $rows['library_fund_account_number'].'</td>
<td>' . $rows['library_fund_amount'].'</td>
<td><a class="buttons edit" href="librarygenerate.php?id=' .$rows['users_id'] .'">VIEW</a></td>
</tr>
<tr class="cha">
<td>7</td>
<td>GAP Amount</td>
<td>' . $rows['gap_amount_account_name'].'</td>
<td>' . $rows['gap_amount_account_number'].'</td>
<td>' . $rows['gap_amounts'].'</td>
<td><a class="buttons edit" href="gapamountgenerate.php?id=' .$rows['users_id'] .'">VIEW</a></td>
</tr>
';
}
echo $output;
}
else{
echo "Record Was not Activated.Will be Notified Once Record is Activated through Email And Notification.";
}
}
if(mysqli\u num\u行($result)<0)
{
echo“您的应用程序状态正在等待管理员处理”;
}
其他的
{
$querys=”
选择*
来自用户
其中username='$\u会话[user]'
用户密码=“$”会话[密码]”
和注册费金额!=''
和bci_集合基金!=''
";
$results=mysqli_查询($conn,$querys);
如果(mysqli_num_行($results)>0){
$output.='
美国号
付款类别
帐户名
帐号
数量
下载查兰
';
while($rows=mysqli\u fetch\u数组($results))
{
$output.='
1.
申请费及印花税
“.$rows[“申请费帐户名]。”
“.$rows[“申请费账户号”]。”
“.$rows[“申请费金额”]”
4.
图书馆基金
“.$rows[“图书馆、基金、账户、名称]。”
“.$rows[“图书馆、基金、账号”]。”
“.$rows[“图书馆基金金额”]”
7.
缺口量
“.$rows['gap\u amount\u account\u name']。”
“.$rows['gap\U amount\U account\U number']”
“.$rows[“差额金额”]”
';
}
echo$输出;
}
否则{
echo“记录未激活。一旦通过电子邮件和通知激活记录,将立即通知。”;
}
}
如果间隙金额为空,则创建一个条件
while($rows = mysqli_fetch_array($results)) {
$output .= '
<tr class="cha">
<td>1</td>
<td>Application Fee & Stamp Duty</td>
<td>' . $rows['application_fee_account_name'].'</td>
<td>' . $rows['application_fee_account_number'].'</td>
<td>' . $rows['application_fee_amount'].'</td>
<td><a class="buttons edit" href="generate.php?id=' .$rows['users_id'] .'">VIEW</a></td>
</tr>
<tr class="cha">
<td>4</td>
<td>Library Fund</td>
<td>' . $rows['library_fund_account_name'].'</td>
<td>' . $rows['library_fund_account_number'].'</td>
<td>' . $rows['library_fund_amount'].'</td>
<td><a class="buttons edit" href="librarygenerate.php?id=' .$rows['users_id'] .'">VIEW</a></td>
</tr>';
if ($rows['gap_amounts'] == null || $rows['gap_amounts'] == '') {
} else {
$output .='<tr class="cha">
<td>7</td>
<td>GAP Amount</td>
<td>' . $rows['gap_amount_account_name'].'</td>
<td>' . $rows['gap_amount_account_number'].'</td>
<td>' . $rows['gap_amounts'].'</td>
<td><a class="buttons edit" href="gapamountgenerate.php?id=' .$rows['users_id'] .'">VIEW</a></td>
</tr>';
}
}
echo $output;
}
else{
echo "Record Was not Activated.Will be Notified Once Record is Activated through Email And Notification.";
}
}
while($rows=mysqli\u fetch\u数组($results)){
$output.='
1.
申请费及印花税
“.$rows[“申请费帐户名]。”
“.$rows[“申请费账户号”]。”
“.$rows[“申请费金额”]”
4.
图书馆基金
“.$rows[“图书馆、基金、账户、名称]。”
“.$rows[“图书馆、基金、账号”]。”
“.$rows[“图书馆基金金额”]”
';
如果($rows['gap_amounts']==null | |$rows['gap_amounts']==''){
}否则{
$output.='
7.
缺口量
“.$rows['gap\u amount\u account\u name']。”
“.$rows['gap\U amount\U account\U number']”
“.$rows[“差额金额”]”
';
}
}
echo$输出;
}
否则{
echo“记录未激活。一旦通过电子邮件和通知激活记录,将立即通知。”;
}
}
只是不要获取数据。。。将和gap_金额不为NULL
添加到您的查询您的代码易受SQL注入的影响。始终使用准备好的语句:不,它显示的是差额金额。我已经更新了我的答案。如果gap_amounts为空,您可以添加条件。添加代码后,它不会显示任何内容。您将代码放在哪里?它应该在表格行中添加差额金额