从最后25行获取空单元格我有点麻烦 我的数据库包含1000篇文章,最后25行没有标题
我执行此查询:
$sql = mysql_query("
SELECT id title
FROM articles
WHERE title IS NOT NULL OR title != ''
ORDER BY id DESC LIMIT 25
");
$total = mysql_num_rows($sql);
echo $total;
$ total show 1000(总行数),我希望显示25(没有标题的行)
我哪里错了?
答案 0 :(得分:1)
你做的恰恰相反。如果您想要 为空的那些,请执行此操作...
$sql = mysql_query("
SELECT id, title
FROM articles
WHERE title IS NULL
OR title = ''
ORDER BY id DESC
LIMIT 25
");