Hi all, I'm baffled by this. I've put together a rather simple newsletter + greeting card app for a company to send their clients personalized corporate e-mails each containing the URL link to the greeting card page. When the user successfully visits the view card page, my code writes the visit date to the cardlist db (MySQL). One of the admin pages (check_visits.php) lets the admin view a table listing of all the user names, email addresses, card sent date and card seen date. Above this table I display the total number of users and the total number of visits. Presently, the table has only 160 records. No cards have been sent yet and thus no visits, but I get a count of 1 for the number of visits ($visitcount) using my following code. It should be 0. The number of users ($usercount) is returned correctly at 160. Any ideas/advice would be much appreciated. Thanks, Lew ------------------- MySQL: 3.23.54 PHP: 4.3.1 Linux ------------------- Table structure for cardlist: `custid` int(10) unsigned NOT NULL auto_increment, `fullname` varchar(100) NOT NULL default '', `email` varchar(100) NOT NULL default '', `cardid` varchar(12) NOT NULL default '0', `sentdate` datetime default NULL, `visitdate` datetime default NULL, PRIMARY KEY (`custid`), UNIQUE KEY `email` (`email`) ------------------- <snipped> code in check_visits.php $sql = "SELECT COUNT(visitdate) FROM cardlist GROUP BY visitdate"; $query = mysql_query($sql) or die("<br><br><div align='center'> Cannot query the database.<br><br>" . "MySQL Error No. " . mysql_errno() . " : <br><br>" . mysql_error() . "<br><br></div>"); $visitcount = mysql_num_rows($query); $sql = "SELECT * FROM cardlist"; $query = mysql_query($sql) or die("<br><br><div align='center'> Cannot query the database.<br><br>" . "MySQL Error No. " . mysql_errno() . " : <br><br>" . mysql_error() . "<br><br></div>"); $usercount = mysql_num_rows($query); echo "<p>Total number of users: $usercount</p>"; echo "<p>Total number of visits: $visitcount</p><br>"; // <--- Should be zero. </snipped> -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php