[eluser]boltsabre[/eluser]
This will only work if 'c1001' is the only thing ever inserted into your complaint_id column... if you have other stuff in there (maybe some 'c1002', c'2001', or even a blank/null value, etc), then this method will not work.
If so, then you will want to first do a query of your table and get the count of the number of times 'c1001' already exists. Something like this (depending on how your doing your db stuff, native sql, active records, or whatever it is, you'll have to ammend the below code to suit, but you get the idea!):
Code:
$checkCount = "SELECT count(*) FROM 'theTableName' WHERE complaint_id = 'c1001'";
Then run this thru and if statement:
Code:
if ($checkCount < 11){ //is less than or equal to 10
//do your stuff here
}else{
//else there are already 10 'c1001' records, do something else, perhaps output a message, or redirect user
}
Hope that helps