Im trying to count all rows and get a number of those that are not empty.
我试图计算所有行并获得一些非空的行。
require_once 'db_conx.php';
$sql = "SELECT COUNT(*) FROM ads";
$result = mysql_query($sql, $con) or trigger_error("SQL", E_USER_ERROR);
$r = mysql_fetch_row($result);
$numrows = $r[0];
$PQR = (!empty($row['position'])) ? $numrows : '';
echo $PQR;
1 个解决方案
#1
3
How about getting only the ones, you need?
如何只获得那些你需要的?
SELECT COUNT(*) FROM ads WHERE position IS NOT NULL or position != '';
$numrows = mysql_numrows( $result );
#1
3
How about getting only the ones, you need?
如何只获得那些你需要的?
SELECT COUNT(*) FROM ads WHERE position IS NOT NULL or position != '';
$numrows = mysql_numrows( $result );