Hi everyone. :-)
Our site gets a ton of traffic on our contact forms, which collect the
standard information (name, address, city, state, zip, home phone,
etc.) The form validation is done with PHP.
To eliminate (or at least deter) people wasting time submitting phony
information, we can compare the state to the zip code (one DB table)
and the zip code to the area code (another table in same DB).
I can use two select statements to compare the state to zip and zip to
area code (respectively), or I can manually create a solution so that
the lookups are done on the client side using JavaScript. If speed
won't be an issue, I prefer to do it using PHP/MySQL because that way
I only have to maintain the zip, state and area code data in the DB.
Having said all of that, below are two questions:
1. Will these simple lookups in each table take that long? To
reiterate: these forms are critical and must work fast. (FYI, there
are about 58,000 records in each table.)
2. Should I index certain fields, or perform some other MySQL admin
task(s) to help increase the speed of the lookups either now (before
implementation) or as regular maintenance?
The table that I use to compare zip to state has the following fields
(of which only the first two are used for what I am describing here):
zip varchar(5)
state char(2)
city varchar(35)
county varchar(35)
primary_city_code int(1)
usps_code char(1)
The 2nd table that has only zip codes and area codes has the following
fields:
zip varchar(5)
area char(3)
I should mention that....
(1) I am an intermediate PHP programmer and beginning MySQL admin.
(2) My web host has PHPMyAdmin installed, which is what I use to
create and maintain the DB and its tables.
(3) Finally, I did pick up Mr. Dubois' MySQL book, although I need to
implement this solution in about 1 week, so I don't have time to
master MySQL without your help! :-)
Thanks for any/all tips to help me finish this project quickly! :-)
- Eric 2 3229
"Eric Linders" <el********@hotmail.com> wrote in message
news:49*************************@posting.google.co m... Hi everyone. :-)
Our site gets a ton of traffic on our contact forms, which collect the standard information (name, address, city, state, zip, home phone, etc.) The form validation is done with PHP.
To eliminate (or at least deter) people wasting time submitting phony information, we can compare the state to the zip code (one DB table) and the zip code to the area code (another table in same DB).
I can use two select statements to compare the state to zip and zip to area code (respectively), or I can manually create a solution so that the lookups are done on the client side using JavaScript. If speed won't be an issue, I prefer to do it using PHP/MySQL because that way I only have to maintain the zip, state and area code data in the DB.
Having said all of that, below are two questions:
1. Will these simple lookups in each table take that long? To reiterate: these forms are critical and must work fast. (FYI, there are about 58,000 records in each table.)
2. Should I index certain fields, or perform some other MySQL admin task(s) to help increase the speed of the lookups either now (before implementation) or as regular maintenance?
[snipped]
Hello Eric,
I'd have thought the best approach would be to use both Javascript (client
side) and PHP / MySQL (server side). Reasoning:-
Assuming 90% of browsers have Javascript enabled, then you might logically
catch 90% of phony information without a lookup to the database. Thereby
speeding up corrections, and without creating uneccessary overhead.
The server side validation should still take place of course, to keep your
data clean.
Regarding your indexes, yes - they should be installed WHERE they are to be
used in your queries. http://www.mysql.com/doc/en/MySQL_indexes.html
You can use EXPLAIN SELECT to optimize http://www.mysql.com/doc/en/EXPLAIN.html
I hope that helps you.
D
"Eric Linders" <el********@hotmail.com> wrote in message
news:49*************************@posting.google.co m... Hi everyone. :-)
Our site gets a ton of traffic on our contact forms, which collect the standard information (name, address, city, state, zip, home phone, etc.) The form validation is done with PHP.
To eliminate (or at least deter) people wasting time submitting phony information, we can compare the state to the zip code (one DB table) and the zip code to the area code (another table in same DB).
I can use two select statements to compare the state to zip and zip to area code (respectively), or I can manually create a solution so that the lookups are done on the client side using JavaScript. If speed won't be an issue, I prefer to do it using PHP/MySQL because that way I only have to maintain the zip, state and area code data in the DB.
Having said all of that, below are two questions:
1. Will these simple lookups in each table take that long? To reiterate: these forms are critical and must work fast. (FYI, there are about 58,000 records in each table.)
2. Should I index certain fields, or perform some other MySQL admin task(s) to help increase the speed of the lookups either now (before implementation) or as regular maintenance?
[snipped]
Hello Eric,
I'd have thought the best approach would be to use both Javascript (client
side) and PHP / MySQL (server side). Reasoning:-
Assuming 90% of browsers have Javascript enabled, then you might logically
catch 90% of phony information without a lookup to the database. Thereby
speeding up corrections, and without creating uneccessary overhead.
The server side validation should still take place of course, to keep your
data clean.
Regarding your indexes, yes - they should be installed WHERE they are to be
used in your queries. http://www.mysql.com/doc/en/MySQL_indexes.html
You can use EXPLAIN SELECT to optimize http://www.mysql.com/doc/en/EXPLAIN.html
I hope that helps you.
D This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: democratix |
last post by:
Hi,
I've only got a couple years experience developing for Access but have
recently been experimenting with HTML/javascript for gui and
client-side scripting, mysql for database and php for...
|
by: John Collyer |
last post by:
Hi,
In assembly language you can use a lookup table to call functions.
1. Lookup function address in table
2. Call the function
Like:
CALL FUNCTION
|
by: Nick L. |
last post by:
All,
This is a general question regarding how, and if, compiler optimization
techniques affect the general concept of being able to update a component of
an application without requiring a...
|
by: Lucas Lemmens |
last post by:
Dear pythonians,
I've been reading/thinking about the famous function call speedup
trick where you use a function in the local context to represent
a "remoter" function to speed up the 'function...
|
by: John Baker |
last post by:
Hi:
I have a general question about table access and look ups.
Over simplifying things,and using a very theoretical example, lets say I have two tables;
Client and Bill.
The client table...
|
by: junky_fellow |
last post by:
what are lookup tables ? How can they be used to optimise the code ?
|
by: TC |
last post by:
I need to design a system which represents multiple "projects" in SQL
Server. Each project has the same data model, but is independent of all
others. My inclination is to use one database to store...
|
by: Andrea Griffini |
last post by:
Hello,
I implemented that crazy idea and seems working... in its
current hacked state can still pass the test suite (exluding
the tests that don't like self generated output on stdout
from...
|
by: Neil |
last post by:
Yikes! My database, which had been consistently 1 gig for a long time, went
from being 1 gig to 3 gigs overnight! Looking at the nightly backups, the
database increased on average about 5-15 MB per...
|
by: DaveD |
last post by:
Let's say I have a collection ("items") of objects that each have a
"string Name" property. I understand I can create a loop like this:
foreach (string name in names) {
var item = (from x in...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |