Training, Open Source
computer languages


PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
limit table to 1 record

Posted by bschultz (bschultz), 6 March 2004
Is this possible?  I only want one record in each table, and an error message if they try to add a second record.  Possible?

Thanks.

Brian

Posted by admin (Graham Ellis), 7 March 2004
It's possible to program (say in PHP) to enquire how many lines there are in a table and then reject a request if it's a request to insert a new row.

BUT ....

I'm concerned at your design.  This seems a very odd thing to be doing. Let me make an educated guess ...

You're THINKING of creating a table for each of a number of baseball grounds, and putting a single row into it to describe next Saturday's match.    

You WOULD BE BEST ADVISED to create a single table for all the baseball grounds, with an extra column to indicate which ground each row applies to.  

If you follow my suggestion, you will not have to change the structure of your database to suit your data.  A SELECT command could be used to see if you already have a row for a particular ground (answering the original question you asked), and you might also wish to have a separate table that contains one row per ground for validation purposes.

Posted by bschultz (bschultz), 8 March 2004
You're right Graham...that's what I'm doing.  I know that it isn't the best layout, but my little brain can grasp it this way.  During the offseason (about June) I'm planning on re-working the whole project to make it "better".  

I've created an "edit" script that will handle what my original question dealt with.  That way, they will only be editing the original, instead of sending a second record when they type something wrong, and need to fix it.

On a side note...I've got 790 form fields for the sport of baseball.  Needless to say, that's a VERY large table (7.0KB empty...about 7.8 when full).  Are indecies the only way to speed things up?  On dial-up, it only takes five seconds or so to load, but I'm thinking of trying to take a bit of the load off the server.

Thanks.

Brian

Posted by admin (Graham Ellis), 9 March 2004
Hi ... not sure about your "efficiency" question.  A form with 790 fields is going to overwhelme people if they have to complete it, but I think you're going to be pre-filling it and letting them edit a few fields?  I don't expect the server load will be very high unless you're doing a lot of processing (e.g. comparing every field to every other, giving a total of over half a million comparisons) and I suspect that, with a modem connection, that will be the limiting factor.   Your 5 seconds is probably the time it takes to get the completed form with 790 values back up the line and the server probably starts to respond in a fraction of that time.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.


WELL HOUSE CONSULTANTS LTD.: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho