Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Stopping entries into dbase with PHP

New Here ,
May 30, 2006 May 30, 2006
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!
TOPICS
Server side applications
237
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 30, 2006 May 30, 2006
LATEST
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


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines