Re: Limit number of entries in a MySQL DB

From: Date: Sun, 24 Sep 2000 21:36:11 +0000
Subject: Re: Limit number of entries in a MySQL DB
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17479@lists.php.net to get a copy of this message
Hello Scott, If i am reading this correctly .. Your db might be like this Team Week info t1 wk1 info t1 wk2 info .... .... If this is correct you simply want to do a 'select' of the table with team = t1 and wk = wk2 and check the result set. If there is a result then do not allow the update. $sql = "SELECT * FROM team_week WHERE team = '$teamid' and week = '$weekid'"; $result = mysql_query($sql) or die ("Unable to get results."); if ($result == "") { # do your processing } Hope this helps .. DSig David Tod Sigafoos Tuesday, September 19, 2000, 9:22:58 PM, you wrote: SW> I am trying to limit entries into a MySQL database to avoid duplicate SW> entries. Users will input values for a $week and $team. Teams can have SW> multiple weeks, but there can not be multiple weeks per team. SW> How can I check the MySQL DB prior to inputting values and if there is SW> already values matching the $week and $team criteria exit and redirect to an SW> update page? SW> Hope this makes sense. I believe this should be fairly simple, but am not SW> sure where to start. Any help would be appreciated.

« previous php.general (#17479) next »