Re: Limit number of entries in a MySQL DB

From: Date: Mon, 25 Sep 2000 18:04:03 +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-17346@lists.php.net to get a copy of this message
*before* you execute any INSERT statements, do a SELECT count(column) from TABLE where week=$week and team='$team' Get the value of the counted column. If it's >0 then there is already something in the database matching that week and team. Scott Webb wrote: > I am trying to limit entries into a MySQL database to avoid duplicate > entries. Users will input values for a $week and $team. Teams can have > multiple weeks, but there can not be multiple weeks per team. > > How can I check the MySQL DB prior to inputting values and if there is > already values matching the $week and $team criteria exit and redirect to an > update page? > > Hope this makes sense. I believe this should be fairly simple, but am not > sure where to start. Any help would be appreciated. > > Thanks, > Scott > > ------------------------------------------------------------------------ > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- ========================== Michael Kimsal http://www.tapinternet.com 734-480-9961

« previous php.general (#17346) next »