Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12484

Re: Loop through array, change headings

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Re: Loop through array, change headings
Date 2014-01-01 18:01 +0100
Message-ID <52C449EE.1050503@arnowelzel.de> (permalink)
References <XnsA2A7852F61CBEarbpenyahoocom@78.46.70.116> <1muwjkgu5s0oj$.1f9jdj8mm94rc$.dlg@40tude.net> <l9viag$1vp$3@dont-email.me> <pu961g31cbxe$.1q7y2fudnvkb7$.dlg@40tude.net>

Show all headers | View raw


Am 01.01.2014 01:19, schrieb richard:

> On Tue, 31 Dec 2013 23:00:32 +0000 (UTC), Denis McMahon wrote:
> 
[...]
>> Here's one example of why Adriennes approach is easier:
>>
>> Supposing Adrienne decides to rename one of the three classifications. In 
>> Adriennes database, that involves a single sql operation on one row in 
>> one table. In your hypothetical and seriously fucked up database design, 
>> you would need to test each row in the whole database to see if the 
>> category was the one that needed to be changed, and then change it. Such 
>> a process is highly inefficient in terms of both cpu effort, memory 
>> management and disk io, and it is to prevent such inefficiencies amongst 
>> other things that relational database design theory has evolved to where 
>> it is today.
>>
>> Unlike your comprehension of computer systems which appears to have 
>> started at nothing and continues to devolve backwards.
> 
> I was merely suggesting one possible way.
> I have never liked the idea of making two tables where one is sufficient.

One table is NOT SUFFICIENT!

Because then EVERY classification has to be repeated over and over again
in every single record.

> In the OP's example, we have going on exactly what you speak of.

No we don't!

> Let's say he wants to add on a second pet shop
> Now he has to change the id's in two tables.

No! "Store" is a CATEGORY and "pet shop" is just an entry. One would
just create a record "Pet shop 2" with the CATEGORY "Store".

> Plus, the remaining id's all have to be changed accordingly.
> So what if he has 1,000 rows?

Even if the CATEGORY of existing entries would have to be changed - this
would be a simple SQL statement.

> He made a change on row 5. So now the sequence of events has to change
> 1990+ items?

No. You don't understand - as usual :-(



-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Loop through array, change headings Adrienne Boswell <arbpen@yahoo.com> - 2013-12-31 21:08 +0000
  Re: Loop through array, change headings Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-31 21:22 +0000
    Re: Loop through array, change headings Adrienne Boswell <arbpen@yahoo.com> - 2013-12-31 23:40 +0000
  Re: Loop through array, change headings richard <noreply@example.com> - 2013-12-31 17:06 -0500
    Re: Loop through array, change headings Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-31 23:00 +0000
      Re: Loop through array, change headings richard <noreply@example.com> - 2013-12-31 19:19 -0500
        Re: Loop through array, change headings Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-01 00:39 +0000
        Re: Loop through array, change headings "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2014-01-01 00:56 +0000
        Re: Loop through array, change headings Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-31 20:50 -0500
          Re: Loop through array, change headings richard <noreply@example.com> - 2013-12-31 21:08 -0500
            Re: Loop through array, change headings Jerry Stuckle <jstucklex@attglobal.net> - 2013-12-31 21:43 -0500
            Re: Loop through array, change headings "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2014-01-01 03:24 +0000
            Re: Loop through array, change headings Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-01 03:26 +0000
        Re: Loop through array, change headings Arno Welzel <usenet@arnowelzel.de> - 2014-01-01 18:01 +0100
        Re: Loop through array, change headings Norman Peelman <npeelman@cfl.rr.com> - 2014-01-02 06:23 -0500
          Re: Loop through array, change headings Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-02 13:09 +0000
            Re: Loop through array, change headings "Peter H. Coffin" <hellsop@ninehells.com> - 2014-01-02 09:20 -0600
              Re: Loop through array, change headings "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2014-01-02 15:39 +0000
                Re: Loop through array, change headings Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-02 10:52 -0500
                Re: Loop through array, change headings "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2014-01-02 16:43 +0000
                Re: Loop through array, change headings "Peter H. Coffin" <hellsop@ninehells.com> - 2014-01-05 18:23 -0600
                Re: Loop through array, change headings "Peter H. Coffin" <hellsop@ninehells.com> - 2014-01-05 18:37 -0600
              Re: Loop through array, change headings Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-02 18:04 +0000
    Re: Loop through array, change headings Arno Welzel <usenet@arnowelzel.de> - 2014-01-01 17:56 +0100

csiph-web