You need to access column by index :
if ( $nt = mysql_fetch_array($q)){
echo $nt[0];
}
(Note if
instead of while
- it's not required, but your query returns at most 1 row, so no need for while
).
If you want to access column by name, change the query to use aliases:
$q=mysql_query(" SELECT COUNT (*) AS total_number FROM menjava
WHERE date_submitted >= DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)",$link2);
// now you can
if ( $nt = mysql_fetch_array($q)){
echo $nt["total_number"];
}
Also, while debugging it makes sense to output errors if any :
$q=mysql_query(....) or die(mysql_error());