最佳答案 你必须使用 MySQL: IS NOT N-6ren">
gpt4 book ai didi

php - 从 mysql select 中排除空数据

转载 作者:行者123 更新时间:2023-11-29 01:19:49 25 4
gpt4 key购买 nike

在排除空数据时遇到问题,我只想提取具有 discord_id 数据的行。这是我的代码:

<?php
$con=mysqli_connect("localhost","site","password","table");

if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM core_members");

while($row = mysqli_fetch_array($result))
{
echo $row['name'] . " " . $row['discord_id'];
echo "<br />";
}

mysqli_close($con);

?>

最佳答案

你必须使用 MySQL: IS NOT NULL如下所示:-

$result = mysqli_query($con,"SELECT * FROM `core_members` WHERE `discord_id` IS NOT NULL");

关于php - 从 mysql select 中排除空数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45915022/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com