Current location: Hot Scripts Forums » Programming Languages » PHP » Limiting database entries


Limiting database entries

Reply
  #1 (permalink)  
Old 05-30-06, 09:09 PM
Eiolon Eiolon is offline
New Member
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Limiting database entries

I need some advice on how to approach this situation.

I have created a sign-up script for an event. The script limits the amount of entries into the database. When someone visits the page, if the limit has been reached, it displays a message saying all the spots are full.

My problem is, if someone signs-up for the last spot, they can hit the back button and keep signing up since the script won't check to see if the limit has been reached when they do that.

Do you have any suggestions? The following is my code:

PHP Code:



<?
$varCount 
40;
$varTotalEntries $totalRows_event;

if (
$varCount $varTotalEntries){
?>



FORM GOES HERE



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

<p>We're sorry, but all the spots are full.</p>

<?php ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-31-06, 05:02 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
always check from the database! that's the solution
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-31-06, 08:06 AM
Rayden Rayden is offline
Newbie Coder
 
Join Date: May 2006
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
I will replace :

Code:
elseif ($varCount <= $varTotalEntries){
by:

Code:
else {
]

since the first condition is more important and the output is a booleam one

and I think that this var $totalRows_event is the limit with database right?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 02:41 AM
Simple, searchable book database max fischer Script Requests 0 05-14-05 02:00 PM
how to rank mysql database entries robbydweb PHP 2 12-22-04 01:42 PM
Help with echo'ing rows of (td's) from database entries paulj000 PHP 6 04-20-04 10:32 AM


All times are GMT -5. The time now is 07:02 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.