Results 1 to 5 of 5
Jul 31, 2012, 01:00 #1
- Join Date
- Aug 2004
- Taunton, UK
- 0 Post(s)
- 0 Thread(s)
Insert counter if doesn't exist otherwise update it.
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
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;
Is the following close to what I need?
$biEmail = "firstname.lastname@example.org"; $sql = "INSERT INTO uploadsperuser (strEmail, intCount) VALUES ($biEmail, 1) ON DUPLICATE KEY UPDATE intCount = intCount + 1";Mediakitchen Limited
App Development | Website Design & Development | Flash Game Development