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


Groups > comp.lang.php > #15157 > unrolled thread

Problem creating a series of tables

Started byrichard <noreply@example.com>
First post2015-03-31 12:14 -0400
Last post2015-04-02 18:44 -0700
Articles 20 on this page of 27 — 9 participants

Back to article view | Back to comp.lang.php


Contents

  Problem creating a series of tables richard <noreply@example.com> - 2015-03-31 12:14 -0400
    Re: Problem creating a series of tables Paul Herber <paul@pherber.com> - 2015-03-31 19:09 +0100
      Re: Problem creating a series of tables richard <noreply@example.com> - 2015-03-31 14:30 -0400
    Re: Problem creating a series of tables Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-31 19:40 +0000
      Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-03-31 16:19 -0400
        Re: Problem creating a series of tables Richard Yates <richard@yatesguitar.com> - 2015-03-31 18:07 -0700
          Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-03-31 21:23 -0400
        Re: Problem creating a series of tables Erwin Moller <erwinmollerusenet@xs4all.nl> - 2015-04-01 12:19 +0200
          Re: Problem creating a series of tables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-02 15:23 +0200
            Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-02 10:17 -0400
      Re: Problem creating a series of tables richard <noreply@example.com> - 2015-03-31 20:14 -0400
        Re: Problem creating a series of tables Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-01 02:44 +0000
          Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-03-31 23:06 -0400
            Re: Problem creating a series of tables richard <noreply@example.com> - 2015-04-01 00:09 -0400
              Re: Problem creating a series of tables Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-01 20:37 +0000
                Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-01 17:08 -0400
      Re: Problem creating a series of tables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-02 14:50 +0200
        Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-02 10:20 -0400
          Re: Problem creating a series of tables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-02 22:32 +0200
            Re: Problem creating a series of tables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-03 00:44 +0200
              Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-02 19:22 -0400
              Re: Problem creating a series of tables Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-02 19:24 -0400
              Re: Problem creating a series of tables "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-04-03 01:46 +0200
                Re: Problem creating a series of tables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-03 20:45 +0200
            Re: Problem creating a series of tables Richard Yates <richard@yatesguitar.com> - 2015-04-02 15:59 -0700
              Re: Problem creating a series of tables Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-04-03 01:10 +0200
                Re: Problem creating a series of tables Richard Yates <richard@yatesguitar.com> - 2015-04-02 18:44 -0700

Page 1 of 2  [1] 2  Next page →


#15157 — Problem creating a series of tables

Fromrichard <noreply@example.com>
Date2015-03-31 12:14 -0400
SubjectProblem creating a series of tables
Message-ID<arrknd1koidz.1uimiwnq5sefe.dlg@40tude.net>
http://mroldies.net/test/numone.php

$numone['60-001']="60-001.mp3"; /sample

$rk=1; / rank shown in left column
$yr=60; /year 
$total=count($numone);
$ct=0; /counter

echo "<table border='1'>";
echo "<tr><th colspan='10'>19$yr</th></tr>";

while ($ct<$total){
$a=$numone['$ct']; /get calue of key
$a=substr($a,0,2); /first 2 characters is year
if ($a=$yr){ /print information if year matches 
echo "<tr><td>$rk</td><td>";
echo $ct."-".$numone['$ct'];
echo "</td><tr>";
}
$rk++;
$ct++;

}

echo "</table>";

I am attempting to print a table from the database.
First row is the year.
Then each table row lists the information according to rank number.

At this point, it loops through ALL of the values and lists the total
number for the array.
It should stop printing when the year no longer matches.
The next table for the next year would then do the same for the next year.
With each year having a different total number (rank) in it.


How can I best do this?

[toc] | [next] | [standalone]


#15158

FromPaul Herber <paul@pherber.com>
Date2015-03-31 19:09 +0100
Message-ID<3molhalj3ccrg5p8ki6svd1gsgjrthpvhb@news.eternal-september.org>
In reply to#15157
On Tue, 31 Mar 2015 12:14:07 -0400, richard <noreply@example.com> wrote:


>if ($a=$yr){ /print information if year matches 

Same old, same old.



-- 
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/
      

[toc] | [prev] | [next] | [standalone]


#15159

Fromrichard <noreply@example.com>
Date2015-03-31 14:30 -0400
Message-ID<1bn2ks2lsm0f8$.18wz1yzxmft5i$.dlg@40tude.net>
In reply to#15158
On Tue, 31 Mar 2015 19:09:36 +0100, Paul Herber wrote:

> On Tue, 31 Mar 2015 12:14:07 -0400, richard <noreply@example.com> wrote:
> 
> 
>>if ($a=$yr){ /print information if year matches 
> 
> Same old, same old.

thanks for the reminder.
But now nothing is printed after the header row.
Not even a table cell.

[toc] | [prev] | [next] | [standalone]


#15160

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-03-31 19:40 +0000
Message-ID<mfet7b$qs$1@dont-email.me>
In reply to#15157
On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:

> I am attempting to print a table from the database.
> First row is the year.
> Then each table row lists the information according to rank number.

It seems you've changed your database layout, as you used to be operating 
on one table per year - in which case there would be no need to include 
the statement "first row is the year"[1] as sensible table names would 
identify the year even in richardian databases.

But - how do you know "first row is the year"[1]? Are you performing a 
sort operation in the mysql query that orders the data?

Remember that if you don't specify a sort order in the mysql query, the 
ordering of the records it returns is random.

[1] Do you mean record when you say row? databases have records and 
fields, not rows and columns, the latter are features of spreadsheets.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#15161

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-03-31 16:19 -0400
Message-ID<mfeve6$gn1$1@dont-email.me>
In reply to#15160
On 3/31/2015 3:40 PM, Denis McMahon wrote:
> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
> 
>> I am attempting to print a table from the database.
>> First row is the year.
>> Then each table row lists the information according to rank number.
> 
> It seems you've changed your database layout, as you used to be operating 
> on one table per year - in which case there would be no need to include 
> the statement "first row is the year"[1] as sensible table names would 
> identify the year even in richardian databases.
> 
> But - how do you know "first row is the year"[1]? Are you performing a 
> sort operation in the mysql query that orders the data?
> 
> Remember that if you don't specify a sort order in the mysql query, the 
> ordering of the records it returns is random.
> 
> [1] Do you mean record when you say row? databases have records and 
> fields, not rows and columns, the latter are features of spreadsheets.
> 

Denis,

Actually, I've always heard the terms "rows" and "columns", ever since
my first introduction to SQL databases around 30 years ago.  Even the
documentation talks about table rows and columns, not records and fields.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#15167

FromRichard Yates <richard@yatesguitar.com>
Date2015-03-31 18:07 -0700
Message-ID<3vgmhahkj642a62aqe4cr6n8c3b7vsm5mh@4ax.com>
In reply to#15161
On Tue, 31 Mar 2015 16:19:06 -0400, Jerry Stuckle
<jstucklex@attglobal.net> wrote:

>On 3/31/2015 3:40 PM, Denis McMahon wrote:
>> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
>> 
>>> I am attempting to print a table from the database.
>>> First row is the year.
>>> Then each table row lists the information according to rank number.
>> 
>> It seems you've changed your database layout, as you used to be operating 
>> on one table per year - in which case there would be no need to include 
>> the statement "first row is the year"[1] as sensible table names would 
>> identify the year even in richardian databases.
>> 
>> But - how do you know "first row is the year"[1]? Are you performing a 
>> sort operation in the mysql query that orders the data?
>> 
>> Remember that if you don't specify a sort order in the mysql query, the 
>> ordering of the records it returns is random.
>> 
>> [1] Do you mean record when you say row? databases have records and 
>> fields, not rows and columns, the latter are features of spreadsheets.
>> 
>
>Denis,
>
>Actually, I've always heard the terms "rows" and "columns", ever since
>my first introduction to SQL databases around 30 years ago.  Even the
>documentation talks about table rows and columns, not records and fields.


And that is the terminology used in phpMyAdmin for setting up mysql
tables.

When I was first teaching myself about this it caused me great
difficulty at first since in the 'Structure' tab the 'columns' are
laid out as rows in the display. If you 'add a column' to the table it
adds a row. Then in the 'Browse' tab the columns  become columns. Very
confusing for a beginner. 

[toc] | [prev] | [next] | [standalone]


#15168

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-03-31 21:23 -0400
Message-ID<mffh8g$ps1$1@dont-email.me>
In reply to#15167
On 3/31/2015 9:07 PM, Richard Yates wrote:
> On Tue, 31 Mar 2015 16:19:06 -0400, Jerry Stuckle
> <jstucklex@attglobal.net> wrote:
> 
>> On 3/31/2015 3:40 PM, Denis McMahon wrote:
>>> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
>>>
>>>> I am attempting to print a table from the database.
>>>> First row is the year.
>>>> Then each table row lists the information according to rank number.
>>>
>>> It seems you've changed your database layout, as you used to be operating 
>>> on one table per year - in which case there would be no need to include 
>>> the statement "first row is the year"[1] as sensible table names would 
>>> identify the year even in richardian databases.
>>>
>>> But - how do you know "first row is the year"[1]? Are you performing a 
>>> sort operation in the mysql query that orders the data?
>>>
>>> Remember that if you don't specify a sort order in the mysql query, the 
>>> ordering of the records it returns is random.
>>>
>>> [1] Do you mean record when you say row? databases have records and 
>>> fields, not rows and columns, the latter are features of spreadsheets.
>>>
>>
>> Denis,
>>
>> Actually, I've always heard the terms "rows" and "columns", ever since
>> my first introduction to SQL databases around 30 years ago.  Even the
>> documentation talks about table rows and columns, not records and fields.
> 
> 
> And that is the terminology used in phpMyAdmin for setting up mysql
> tables.
> 
> When I was first teaching myself about this it caused me great
> difficulty at first since in the 'Structure' tab the 'columns' are
> laid out as rows in the display. If you 'add a column' to the table it
> adds a row. Then in the 'Browse' tab the columns  become columns. Very
> confusing for a beginner. 
> 

Yes, I can see where that can be confusing.  But remember that
PhpMyAdmin is not the database - it is only a front end to the database.
 The page you're talking about shows the structure of the database,
which is more appropriate to the data being displayed.

If, OTOH, you make a SQL query so you see the data (instead of the
structure), you get the rows and columns.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#15174

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2015-04-01 12:19 +0200
Message-ID<551bc617$0$2845$e4fe514c@news2.news.xs4all.nl>
In reply to#15161
On 3/31/2015 10:19 PM, Jerry Stuckle wrote:
> On 3/31/2015 3:40 PM, Denis McMahon wrote:
>> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
>>

<snip>

>>
>> [1] Do you mean record when you say row? databases have records and
>> fields, not rows and columns, the latter are features of spreadsheets.
>>
>
> Denis,
>
> Actually, I've always heard the terms "rows" and "columns", ever since
> my first introduction to SQL databases around 30 years ago.  Even the
> documentation talks about table rows and columns, not records and fields.
>


Thanks for making a point about that. I strongly prefer rows and columns 
too.

I first encountered "records and fields" when working with Microsoft 
Classic ASP/VB and their adodb drivers to Access. (And Collections and 
Items, arrrgh, what a syntactic mess they created.)
Maybe PHPMyAdmin borrowed from MS.

And I fully agree with your statement: we don't need more synonyms.

Why is it people like to invent new words/meanings for concepts that 
already exists? To confuse the hell out of us all?


Regards,
Erwin Moller

-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens

[toc] | [prev] | [next] | [standalone]


#15187

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-04-02 15:23 +0200
Message-ID<2444940.C2VyNPdkgh@PointedEars.de>
In reply to#15174
Erwin Moller wrote:

> On 3/31/2015 10:19 PM, Jerry Stuckle wrote:
>> Actually, I've always heard the terms "rows" and "columns", ever since
>> my first introduction to SQL databases around 30 years ago.  Even the
>> documentation talks about table rows and columns, not records and fields.
> 
> Thanks for making a point about that. I strongly prefer rows and columns
> too.
> 
> I first encountered "records and fields" when working with Microsoft
> Classic ASP/VB and their adodb drivers to Access. (And Collections and
> Items, arrrgh, what a syntactic mess they created.)
> Maybe PHPMyAdmin borrowed from MS.
> 
> And I fully agree with your statement: we don't need more synonyms.
> 
> Why is it people like to invent new words/meanings for concepts that
> already exists? To confuse the hell out of us all?

To me, a row and a record are synonymous, as are rows and recordsets, 
respectively.  However, I think of a field rather as an element of a row or 
column, like a table cell, so that for a table with 42 rows/records a column 
has 42 fields.  Likewise, if that table has 23 columns, each row has 23 
fields (because it is an *relational* database; for an object-oriented 
database the number and kind of fields, or properties, can vary).

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#15188

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-04-02 10:17 -0400
Message-ID<mfjj13$5nq$1@dont-email.me>
In reply to#15187
On 4/2/2015 9:23 AM, the pedantic troll Thomas 'Pointed Head' Lahn wrote:
> Erwin Moller wrote:
> 
>> On 3/31/2015 10:19 PM, Jerry Stuckle wrote:
>>> Actually, I've always heard the terms "rows" and "columns", ever since
>>> my first introduction to SQL databases around 30 years ago.  Even the
>>> documentation talks about table rows and columns, not records and fields.
>>
>> Thanks for making a point about that. I strongly prefer rows and columns
>> too.
>>
>> I first encountered "records and fields" when working with Microsoft
>> Classic ASP/VB and their adodb drivers to Access. (And Collections and
>> Items, arrrgh, what a syntactic mess they created.)
>> Maybe PHPMyAdmin borrowed from MS.
>>
>> And I fully agree with your statement: we don't need more synonyms.
>>
>> Why is it people like to invent new words/meanings for concepts that
>> already exists? To confuse the hell out of us all?
> 
> To me, a row and a record are synonymous, as are rows and recordsets, 
> respectively.  However, I think of a field rather as an element of a row or 
> column, like a table cell, so that for a table with 42 rows/records a column 
> has 42 fields.  Likewise, if that table has 23 columns, each row has 23 
> fields (because it is an *relational* database; for an object-oriented 
> database the number and kind of fields, or properties, can vary).
> 

That's because you're an idiot besides being a pedantic troll.

Knowledgeable people use the correct terminology.  That way there is no
confusion.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#15166

Fromrichard <noreply@example.com>
Date2015-03-31 20:14 -0400
Message-ID<12sqlyif0ye7g$.8efwkd8hlpwz$.dlg@40tude.net>
In reply to#15160
On Tue, 31 Mar 2015 19:40:28 +0000 (UTC), Denis McMahon wrote:

> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
> 
>> I am attempting to print a table from the database.
>> First row is the year.
>> Then each table row lists the information according to rank number.
> 
> It seems you've changed your database layout, as you used to be operating 
> on one table per year - in which case there would be no need to include 
> the statement "first row is the year"[1] as sensible table names would 
> identify the year even in richardian databases.
> 
> But - how do you know "first row is the year"[1]? Are you performing a 
> sort operation in the mysql query that orders the data?
> 
> Remember that if you don't specify a sort order in the mysql query, the 
> ordering of the records it returns is random.
> 
> [1] Do you mean record when you say row? databases have records and 
> fields, not rows and columns, the latter are features of spreadsheets.

Totally wrong assumption.

I am speaking of an html table row.
Did you not notice the <table> tag>

At this point in time I have not yet said anything about gathering
information from a database!

My ctual database is desinged to contain the records for each song of each
year. With the song ID as key. There are around 7500 records in the
database.

This is my actual database
http://mroldies.net/table1960x.php

[toc] | [prev] | [next] | [standalone]


#15170

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2015-04-01 02:44 +0000
Message-ID<XnsA46EE742C13CDdougmilmaccom@213.239.209.88>
In reply to#15166
richard <noreply@example.com> wrote in news:12sqlyif0ye7g$.8efwkd8hlpwz$.dlg@
40tude.net:

> On Tue, 31 Mar 2015 19:40:28 +0000 (UTC), Denis McMahon wrote:
> 
>> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
>> 
>>> I am attempting to print a table from the database.
>>> First row is the year.
[...]
>> [1] Do you mean record when you say row? databases have records and 
>> fields, not rows and columns, the latter are features of spreadsheets.
> 
> Totally wrong assumption.
> 
> I am speaking of an html table row.
> Did you not notice the <table> tag>

Did you not notice that you wrote the following?
    	I am attempting to print a table from a database.
    	First row is the year.

I think Denis can be forgiven for supposing that "First row" referred to the database which 
was mentioned in the immediately preceding word.
> 
> At this point in time I have not yet said anything about gathering
> information from a database!

So on Planet Richard, "I am attempting to print a table from a database" says nothing about 
gathering information from a database?

> 
> My ctual database is desinged to contain the records for each song of each
> year. With the song ID as key. There are around 7500 records in the
> database.
> 
> This is my actual database
> http://mroldies.net/table1960x.php

No it isn't. That's an HTML representation of something, possibly a database, possibly a 
spreadsheet, but it certainly isn't a database.

[toc] | [prev] | [next] | [standalone]


#15171

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-03-31 23:06 -0400
Message-ID<mffn9h$gq$1@dont-email.me>
In reply to#15170
On 3/31/2015 10:44 PM, Doug Miller wrote:
> richard <noreply@example.com> wrote in news:12sqlyif0ye7g$.8efwkd8hlpwz$.dlg@
> 40tude.net:
> 
>> On Tue, 31 Mar 2015 19:40:28 +0000 (UTC), Denis McMahon wrote:
>>
>>> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
>>>
>>>> I am attempting to print a table from the database.
>>>> First row is the year.
> [...]
>>> [1] Do you mean record when you say row? databases have records and 
>>> fields, not rows and columns, the latter are features of spreadsheets.
>>
>> Totally wrong assumption.
>>
>> I am speaking of an html table row.
>> Did you not notice the <table> tag>
> 
> Did you not notice that you wrote the following?
>     	I am attempting to print a table from a database.
>     	First row is the year.
> 
> I think Denis can be forgiven for supposing that "First row" referred to the database which 
> was mentioned in the immediately preceding word.
>>
>> At this point in time I have not yet said anything about gathering
>> information from a database!
> 
> So on Planet Richard, "I am attempting to print a table from a database" says nothing about 
> gathering information from a database?
> 
>>
>> My ctual database is desinged to contain the records for each song of each
>> year. With the song ID as key. There are around 7500 records in the
>> database.
>>
>> This is my actual database
>> http://mroldies.net/table1960x.php
> 
> No it isn't. That's an HTML representation of something, possibly a database, possibly a 
> spreadsheet, but it certainly isn't a database.
> 
> 

Your comment is interesting - because it's exactly how I've seen
databases represented in print, including from Microsoft, Oracle and
IBM.  And when I was teaching SQL, it's how I displayed databases in my
courseware.

Not necessarily in HTML, but exactly the same layout.

How do YOU display a database on a web page?

In this case I think you're wrongly criticizing richard - and owe him an
apology.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#15172

Fromrichard <noreply@example.com>
Date2015-04-01 00:09 -0400
Message-ID<1emmkj2g4mip4$.dc77b3s8ewpo.dlg@40tude.net>
In reply to#15171
On Tue, 31 Mar 2015 23:06:11 -0400, Jerry Stuckle wrote:

> On 3/31/2015 10:44 PM, Doug Miller wrote:
>> richard <noreply@example.com> wrote in news:12sqlyif0ye7g$.8efwkd8hlpwz$.dlg@
>> 40tude.net:
>> 
>>> On Tue, 31 Mar 2015 19:40:28 +0000 (UTC), Denis McMahon wrote:
>>>
>>>> On Tue, 31 Mar 2015 12:14:07 -0400, richard wrote:
>>>>
>>>>> I am attempting to print a table from the database.
>>>>> First row is the year.
>> [...]
>>>> [1] Do you mean record when you say row? databases have records and 
>>>> fields, not rows and columns, the latter are features of spreadsheets.
>>>
>>> Totally wrong assumption.
>>>
>>> I am speaking of an html table row.
>>> Did you not notice the <table> tag>
>> 
>> Did you not notice that you wrote the following?
>>     	I am attempting to print a table from a database.
>>     	First row is the year.
>> 
>> I think Denis can be forgiven for supposing that "First row" referred to the database which 
>> was mentioned in the immediately preceding word.
>>>
>>> At this point in time I have not yet said anything about gathering
>>> information from a database!
>> 
>> So on Planet Richard, "I am attempting to print a table from a database" says nothing about 
>> gathering information from a database?
>> 
>>>
>>> My ctual database is desinged to contain the records for each song of each
>>> year. With the song ID as key. There are around 7500 records in the
>>> database.
>>>
>>> This is my actual database
>>> http://mroldies.net/table1960x.php
>> 
>> No it isn't. That's an HTML representation of something, possibly a database, possibly a 
>> spreadsheet, but it certainly isn't a database.
>> 
>> 
> 
> Your comment is interesting - because it's exactly how I've seen
> databases represented in print, including from Microsoft, Oracle and
> IBM.  And when I was teaching SQL, it's how I displayed databases in my
> courseware.
> 
> Not necessarily in HTML, but exactly the same layout.
> 
> How do YOU display a database on a web page?
> 
> In this case I think you're wrongly criticizing richard - and owe him an
> apology.

Coming from you, that was totally unexpected.
Thank you.

A database is technically a collection of tables.
A table has columns and rows.
A record consists of at least one row and one column.
Each division of a row and column, is called a data cell.

Now how else are you go to display a "table" on paper?

Originally, I assumed people would understand that when I said I was
wanting to PRINT a table, that the outputy would be on "paper".

In mysql, the stored database table really doesn't give a damn about how
those records are stored. Only that the data cell information is in the
proper cell.

[toc] | [prev] | [next] | [standalone]


#15183

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2015-04-01 20:37 +0000
Message-ID<XnsA46FA91F86A3Cdougmilmaccom@213.239.209.88>
In reply to#15172
richard <noreply@example.com> wrote in news:1emmkj2g4mip4$.dc77b3s8ewpo.dlg@
40tude.net:

> On Tue, 31 Mar 2015 23:06:11 -0400, Jerry Stuckle wrote:
> 
[...]
>> 
>> How do YOU display a database on a web page?
>> 
>> In this case I think you're wrongly criticizing richard - and owe him an
>> apology.
> 
> Coming from you, that was totally unexpected.
> Thank you.
[...]
The point you're both missing is that richard *still* doesn't seem to understand that when he 
posts a link to a php page, all we can see is the presentation, not the underlying code or 
structure.

[toc] | [prev] | [next] | [standalone]


#15184

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-04-01 17:08 -0400
Message-ID<mfhmm1$56n$1@dont-email.me>
In reply to#15183
On 4/1/2015 4:37 PM, Doug Miller wrote:
> richard <noreply@example.com> wrote in news:1emmkj2g4mip4$.dc77b3s8ewpo.dlg@
> 40tude.net:
> 
>> On Tue, 31 Mar 2015 23:06:11 -0400, Jerry Stuckle wrote:
>>
> [...]
>>>
>>> How do YOU display a database on a web page?
>>>
>>> In this case I think you're wrongly criticizing richard - and owe him an
>>> apology.
>>
>> Coming from you, that was totally unexpected.
>> Thank you.
> [...]
> The point you're both missing is that richard *still* doesn't seem to understand that when he 
> posts a link to a php page, all we can see is the presentation, not the underlying code or 
> structure.
> 

Which is exactly what was needed to see in this case.  That's what
YOU'RE missing.


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#15186

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-04-02 14:50 +0200
Message-ID<1957209.MyoqzTBkhW@PointedEars.de>
In reply to#15160
Denis McMahon wrote:

> Remember that if you don't specify a sort order in the mysql query, the
> ordering of the records it returns is random.

Incorrect.  The ordering is undefined if the table has no keys that define 
sort order.  For example, for a InnoDb table named `test` that has

| Field   Type    Null    Key     Default Extra
| id      int(10) unsigned        NO      PRI     NULL    auto_increment

the result of the MySQL query

| SELECT * FROM `test` LIMIT 1

will be the record with the smallest `id` field value.

$ php -v
PHP 5.6.7-1 (cli) (built: Mar 24 2015 12:30:15) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend 
Technologies
    with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans

$ mysql -V
mysql  Ver 14.14 Distrib 5.5.42, for debian-linux-gnu (x86_64) using 
readline 6.3

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#15189

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-04-02 10:20 -0400
Message-ID<mfjj60$5nq$2@dont-email.me>
In reply to#15186
On 4/2/2015 8:50 AM, the pedantic troll Thomas 'Pointed Head' Lahn wrote:
> Denis McMahon wrote:
> 
>> Remember that if you don't specify a sort order in the mysql query, the
>> ordering of the records it returns is random.
> 
> Incorrect.  The ordering is undefined if the table has no keys that define 
> sort order.  For example, for a InnoDb table named `test` that has
> 
> | Field   Type    Null    Key     Default Extra
> | id      int(10) unsigned        NO      PRI     NULL    auto_increment
> 
> the result of the MySQL query
> 
> | SELECT * FROM `test` LIMIT 1
> 
> will be the record with the smallest `id` field value.
> 
> $ php -v
> PHP 5.6.7-1 (cli) (built: Mar 24 2015 12:30:15) 
> Copyright (c) 1997-2015 The PHP Group
> Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
>     with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend 
> Technologies
>     with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans
> 
> $ mysql -V
> mysql  Ver 14.14 Distrib 5.5.42, for debian-linux-gnu (x86_64) using 
> readline 6.3
> 

Incorrect (again).  It will return the first row in the table - which
may or may not be the one with the smallest 'id' value.

By definition, order is undefined in a SQL database unless the ORDER BY
clause is specified.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#15190

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-04-02 22:32 +0200
Message-ID<1928459.l4EcNPIvok@PointedEars.de>
In reply to#15189
Jerry Stuckle wrote:

> On 4/2/2015 8:50 AM, the pedantic troll Thomas 'Pointed Head' Lahn wrote:
>> Denis McMahon wrote:
>>> Remember that if you don't specify a sort order in the mysql query, the
>>> ordering of the records it returns is random.
>> 
>> Incorrect.  The ordering is undefined if the table has no keys that
>> define
>> sort order.  For example, for a InnoDb table named `test` that has
>> 
>> | Field   Type    Null    Key     Default Extra
>> | id      int(10) unsigned        NO      PRI     NULL    auto_increment
>> 
>> the result of the MySQL query
>> 
>> | SELECT * FROM `test` LIMIT 1
>> 
>> will be the record with the smallest `id` field value.
>> 
>> $ php -v
>> PHP 5.6.7-1 (cli) (built: Mar 24 2015 12:30:15)
>> Copyright (c) 1997-2015 The PHP Group
>> Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
>>     with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend
>> Technologies
>>     with Xdebug v2.2.6, Copyright (c) 2002-2014, by Derick Rethans
>> 
>> $ mysql -V
>> mysql  Ver 14.14 Distrib 5.5.42, for debian-linux-gnu (x86_64) using
>> readline 6.3
> 
> Incorrect (again).  It will return the first row in the table - which
> may or may not be the one with the smallest 'id' value.

Si tacuisses, philosophus mansisses.

,----
| mysql> create temporary table tmp (id int(10) primary key not null);
| Query OK, 0 rows affected (0.01 sec)
| 
| mysql> explain tmp;
| +-------+---------+------+-----+---------+-------+
| | Field | Type    | Null | Key | Default | Extra |
| +-------+---------+------+-----+---------+-------+
| | id    | int(10) | NO   | PRI | NULL    |       |
| +-------+---------+------+-----+---------+-------+
| 1 row in set (0.01 sec)
| 
| mysql> insert into tmp values (1);
| Query OK, 1 row affected (0.00 sec)
| 
| mysql> insert into tmp values (0);
| Query OK, 1 row affected (0.01 sec)
| 
| mysql> select * from tmp;
| +----+
| | id |
| +----+
| |  0 |
| |  1 |
| +----+
| 2 rows in set (0.00 sec)
`----

> By definition, order is undefined in a SQL database unless the ORDER BY
> clause is specified.

So much for theory – for which you want to cite evidence.

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#15192

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-04-03 00:44 +0200
Message-ID<2535888.CQyUAPWPjF@PointedEars.de>
In reply to#15190
Thomas 'PointedEars' Lahn wrote:

> ,----
> | mysql> create temporary table tmp (id int(10) primary key not null);
> | Query OK, 0 rows affected (0.01 sec)
> | 
> | mysql> explain tmp;
> | +-------+---------+------+-----+---------+-------+
> | | Field | Type    | Null | Key | Default | Extra |
> | +-------+---------+------+-----+---------+-------+
> | | id    | int(10) | NO   | PRI | NULL    |       |
> | +-------+---------+------+-----+---------+-------+
> | 1 row in set (0.01 sec)
> | 
> | mysql> insert into tmp values (1);
> | Query OK, 1 row affected (0.00 sec)
> | 
> | mysql> insert into tmp values (0);
> | Query OK, 1 row affected (0.01 sec)
> | 
> | mysql> select * from tmp;
> | +----+
> | | id |
> | +----+
> | |  0 |
> | |  1 |
> | +----+
> | 2 rows in set (0.00 sec)
> `----

I realize that this is not a good test.  The order could still be arbitrary; 
one run is insufficient to show the opposite.  But by the law of large 
numbers, if the order of result records would be arbitrary, the record “1” 
should occur at first position about 50 % of the time, and there should be 
at least one occurrence of “1” at first position.  But:

$ mysql -u root -p$pass <<<'create database tmp; use tmp; create table tmp 
(id int(10) primary key not null); insert into tmp values (1); insert into 
tmp values (0);'

$ for i in $(seq 1 100); do mysql -u root -p$pass <<<'use tmp; select id 
from tmp limit 1\G'; done | grep '^id: 0' | wc -l
100

$ for i in $(seq 1 1000); do mysql -u root -p$pass <<<'use tmp; select id 
from tmp limit 1\G'; done | grep '^id: 1' | wc -l
0

$ for i in $(seq 1 10000); do mysql -u root -p$pass <<<'use tmp; select id 
from tmp limit 1\G'; done | grep '^id: 1' | wc -l
0

$ for i in $(seq 1 100000); do mysql -u root -p$pass <<<'use tmp; select 
id from tmp limit 1\G'; done | grep '^id: 1' | wc -l
0

You can repeat this with ever larger numbers; the results are consistent: 
Never once is “1” at first position.  Because “0” always is, although that 
record had been inserted *after* “1”.  Conclusion: The result records are 
sorted by primary key.  Q.E.D.

-- 
PointedEars
Zend Certified PHP Engineer
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.php


csiph-web