[Wolves] php/mysql wizzards please - sparkes?

Ron Wellsted ron at wellsted.org.uk
Fri Mar 12 22:03:58 GMT 2004


On Friday 12 March 2004 21:02, Wayne Morris wrote:
- - - - - 8<
>
> 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.

- - - - - 8<
>
> 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.

you could use a  function (in an included file) to populate the county select.

>
> 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
> time!
>
>
> 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 ;-)
>
- - - - - - 8<
> Wayne

It may be work simplifying the database design here.  Why not just provide 4 
varchar(64) columns for the addresses to be stored in?

-- 
Ron Wellsted
http://www.wellsted.org.uk
ron at wellsted.org.uk
N 52.567623, W 2.137621




More information about the Wolves mailing list