Skip to main content
Known Participant
May 30, 2006
Question

Stopping entries into dbase with PHP

  • May 30, 2006
  • 1 reply
  • 239 views
Since I don't know PHP, I am using Dreamweaver 8 to insert information into a MySQL database. The insert form works fine but what I'd like to do is stop allowing entries after a certain amount. Can anyone please provide me with code to accomplish this if it isn't too much of trouble? Thanks!
This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
May 30, 2006
The most simple method I could think of:

1. create recordset for table which contains entries
2. Set variable for how many records table should hold. THis can be defined
in the page, or defined in your database and pulled into page.
a. if defined in database, create a recordset to get the variable
b. set $varCount = Recordset info for max number
3. Pull out recordset count (manual or via Server Behaviors) & set to
variable
3. Put an IF statement before your entry form.

<?
//This will be your recordset data
$varCount = 12;
$varTotalEntries = $totalRows_RECORDSETNAME;

if ($varCount > $varTotalEntries){
?>

<ENTRY FORM HERE>

<?php
}
elseif ($varCount <= $varTotalEntries){
?>

<p class="alert">We're sorry, but you have entered the maximum number of
entries</p>
<p> Some proceddure for them to follow here</p>

<?php } ?>

HTH,

Jon