[Wolves] php/mysql wizzards please - sparkes?

Wayne Morris wayne at machx.co.uk
Fri Mar 12 21:02:49 GMT 2004

On Fri, 2004-03-12 at 20:18, Ron Wellsted wrote:
> On Friday 12 March 2004 19:21, sparkes wrote:
> > On Fri, 2004-03-12 at 18:18, Wayne Morris wrote:
> > > Anyone tell me what I should be doing?
> >
> > not reducing the normalisation on a working database ;-)

Not working, county table currently idle as i haven't figured using
multiple tables yet! ;-)
County table is only there cos I imported it from an Access db which did
work. See below.
> >
> > If you are not experiencing problems with the app I would leave this
> > alone as it stops people buggering up the database with mispelt
> > counties.
> I agree.
> Since the dataset of counties has been fixed since 1976 (IIRC) leave well 
> alone.   You are also keeping the DB smaller (and faster) as a county name 
> can be 15-20 chars whereas the reference number should only be 2 digits.
> As a general question, this might give a clue as to why you are failing.  What 
> is the type of the phonelist.county column? if is is an int, it cannot hold a 
> (var)char string, so your update query will fail.

The database is a hangover from an Access database where the county
table was a linked one to the main table, and created by me - so the
county-to-number wasn't anything standard, just made up as i got a new
customer in a new county.

I only have around a 1000 records, so I figured that the lookup time for
the county field being populated by real data was a zillion times
quicker than me having to code (ok learn how to code, then code!) the
lines necessary to look up two tables and join them every time i want a
county field in one of my php pages.
I mean, if I want to display a county field in a page its effectively
just (simplified):
SELECT * from table
echo county 
And to update it is just 
UPDATE every variable into one table

whereas to do it with two tables is something like
SELECT * from table
SELECT * from county
Fancy bit of code to insert county name instead of ID.
Clever drop down list to select.
UPDATE most variable into one table, nother update just to set the
county bit.

I used to get confused to hell just using Access to link tables and my
forms would end up displaying the county id instead of the name half the

I know theoretically the database is much more efficient with linked
tables, but is it really worth the saving in microseconds (on such a
small record set), compared with all the extra code to debug when
writing pages?
Apart from the reading from database, I find it hard enough to update
the contents of one table with php without trying to insert into two
simultaneously ;-)

> >
> > > Cheers.
> > >
> > > Wayne Morris
> PS Is putting your mobile number into a web-archived email a good idea? or 
> just a way of attracting SMS-spam?
Good point, I keep forget this is archived, and forget to turn of the
sig. Cheers.


More information about the Wolves mailing list