I want to limit the uploads on a site to 3 uploads per user.

I have therefore created a separate table to store a count of the uploads per email address as follows


Code:
CREATE TABLE IF NOT EXISTS `uploadsperuser` (
  `strEmail` varchar(255) NOT NULL,
  `intCount` int(3) NOT NULL,
  PRIMARY KEY (`strEmail`,`intCount`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Before inserting a record in the uploads table I want to check the count and insert or increment depending on which is necessary.

Is the following close to what I need?

Code:
$biEmail = "tester@test.com";

$sql = "INSERT INTO uploadsperuser (strEmail, intCount) VALUES ($biEmail, 1) ON DUPLICATE KEY UPDATE intCount = intCount + 1";
Thanks inadvance