在 PHP 中,我想$subject
使用 if 语句创建一个数组,例如
我已经有一个可能有数据或未命名的数组$remark
这就是我想要的
$con=mysqli_connect("localhost","root","anderpoye","ex_smartcard2013");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result3 = mysqli_query($con,"SELECT name,remark FROM sec_users where sec_users.email = 'shivesh@lotus.edu.in'");
while($row = mysqli_fetch_array($result3))
{
if($row['remark'])
{
$remark= $row['remark'];
if $remark = null then $subject = "action Required"
else $subject = "";
echo $subject;
}
}
表示如果 $remark 为空则 $subject = "action required" 否则如果 $remark 包含一些数据则 $subject = "" 表示空