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


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

fetching all items at once - how do you code to display them?

Started byrichard <noreply@example.com>
First post2015-04-03 21:54 -0400
Last post2015-04-06 02:05 +0000
Articles 5 on this page of 25 — 7 participants

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


Contents

  fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-03 21:54 -0400
    Re: fetching all items at once - how do you code to display them? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-03 22:14 -0400
    Re: fetching all items at once - how do you code to display them? Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-04 23:28 +0000
      Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-04 19:32 -0400
        Re: fetching all items at once - how do you code to display them? Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-05 01:15 +0000
          Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-05 10:56 -0400
            Re: fetching all items at once - how do you code to display them? Richard Yates <richard@yatesguitar.com> - 2015-04-05 08:14 -0700
              Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-05 11:24 -0400
            Re: fetching all items at once - how do you code to display them? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-05 11:18 -0400
              Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-05 11:28 -0400
                Re: fetching all items at once - how do you code to display them? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-05 11:52 -0400
                  Re: fetching all items at once - how do you code to display them? Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-06 02:01 +0000
                    Re: fetching all items at once - how do you code to display them? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-08 20:16 -0400
                      Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-09 22:32 -0400
                        Re: fetching all items at once - how do you code to display them? Richard Heathfield <rjh@cpax.org.uk> - 2015-04-10 07:48 +0100
                        Re: fetching all items at once - how do you code to display them? Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-11 03:11 +0000
              Re: fetching all items at once - how do you code to display them? Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-06 07:58 +0000
            Re: fetching all items at once - how do you code to display them? Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-06 07:48 +0000
        Re: fetching all items at once - how do you code to display them? Denis McMahon <denismfmcmahon@gmail.com> - 2015-04-05 04:47 +0000
          Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-05 10:58 -0400
            Re: fetching all items at once - how do you code to display them? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-05 11:21 -0400
              Re: fetching all items at once - how do you code to display them? richard <noreply@example.com> - 2015-04-05 11:40 -0400
                Re: fetching all items at once - how do you code to display them? Jerry Stuckle <jstucklex@attglobal.net> - 2015-04-05 14:55 -0400
                Re: fetching all items at once - how do you code to display them? Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-06 02:07 +0000
            Re: fetching all items at once - how do you code to display them? Doug Miller <doug_at_milmac_dot_com@example.com> - 2015-04-06 02:05 +0000

Page 2 of 2 — ← Prev page 1 [2]


#15210

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-04-05 11:21 -0400
Message-ID<mfrjrc$kbm$1@dont-email.me>
In reply to#15207
On 4/5/2015 10:58 AM, richard wrote:
> On Sun, 5 Apr 2015 04:47:05 +0000 (UTC), Denis McMahon wrote:
> 
>> On Sat, 04 Apr 2015 19:32:29 -0400, richard wrote:
>>
>>> On Sat, 4 Apr 2015 23:28:57 +0000 (UTC), Denis McMahon wrote:
>>>
>>>> On Fri, 03 Apr 2015 21:54:12 -0400, richard wrote:
>>>>
>>>>> "SELECT * from sixty where (
>>>>>   (peak='1')
>>>>>   AND  (year>1959)
>>>>>   AND  (year<1970)
>>>>> ) ORDER BY year, sid "
>>>>>
>>>>> Considering this code provided by Erwin Moller, how does one now
>>>>> display the information?
>>>>>
>>>>> The standard method of using $row=$result() winds up with only the
>>>>> first item ending up in a displayed table while the other items are
>>>>> just bunched up together one after the other.
>>>>>
>>>>> If I simply fetch one item at a time, the table is displayed as
>>>>> wanted.
>>>>>
>>>>> By this usage of the word "table" I am not speaking of the database
>>>>> table stored on the server. But the html displayed table on the page.
>>>>
>>>> Note that the following is an example that assumes the reader has some
>>>> competencies and understanding of php, and the use of the ellipsis
>>>>
>>>> <?php
>>>>
>>>> // Start the table:
>>>>
>>>> echo "<table>\n";
>>>>
>>>> // print the table header row
>>>>
>>>> echo "<tr> <th>header</th>... </tr>\n";
>>>>
>>>> // use a loop that fetches every row from the mysqli result // this
>>>> example assumes the mysqli result is in $result // $data is a local
>>>> variable in the loop
>>>>
>>>> while ($data = mysqli_fetch_assoc($result)) {
>>>>
>>>> // in here you write out a single table row for each set of // $data
>>>> from the query result
>>>>
>>>> echo "<tr> <td>{$data['fieldname']}</td>... </tr>\n";
>>>>
>>>> }
>>>>
>>>> // close the table
>>>>
>>>> echo "</table>";
>>>>
>>>> ?>
>>>
>>> Done that.
>>> What I get is 11 duplicates of the first item.
>>> So why does it stop at 11 when I have 200 records?
>>
>> Perhaps your query is not fetching the data you think it is. Without 
>> running your query against your datatable at the mysql command line, it's 
>> hard to tell.
>>
>> I suspect but I can't be sure that the reason you're getting 11 values 
>> might be linked to the "(year>1959) AND (year<1970)" part of the query.
>>
>> There might be an issue if you have stored years as strings and are now 
>> trying to compare those strings with a numeric value. I'm not sure, 
>> because I don't usually try to compare strings with numbers in mysql.
> 
> I tried using the "between" part and that resulted in displaying "0".
> 

Which goes back to Denis's original comment - how is the 'year" column
defined in your database?

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

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


#15213

Fromrichard <noreply@example.com>
Date2015-04-05 11:40 -0400
Message-ID<13xqlknyrvdkn$.kascoyjwfeg8.dlg@40tude.net>
In reply to#15210
On Sun, 05 Apr 2015 11:21:04 -0400, Jerry Stuckle wrote:

> On 4/5/2015 10:58 AM, richard wrote:
>> On Sun, 5 Apr 2015 04:47:05 +0000 (UTC), Denis McMahon wrote:
>> 
>>> On Sat, 04 Apr 2015 19:32:29 -0400, richard wrote:
>>>
>>>> On Sat, 4 Apr 2015 23:28:57 +0000 (UTC), Denis McMahon wrote:
>>>>
>>>>> On Fri, 03 Apr 2015 21:54:12 -0400, richard wrote:
>>>>>
>>>>>> "SELECT * from sixty where (
>>>>>>   (peak='1')
>>>>>>   AND  (year>1959)
>>>>>>   AND  (year<1970)
>>>>>> ) ORDER BY year, sid "
>>>>>>
>>>>>> Considering this code provided by Erwin Moller, how does one now
>>>>>> display the information?
>>>>>>
>>>>>> The standard method of using $row=$result() winds up with only the
>>>>>> first item ending up in a displayed table while the other items are
>>>>>> just bunched up together one after the other.
>>>>>>
>>>>>> If I simply fetch one item at a time, the table is displayed as
>>>>>> wanted.
>>>>>>
>>>>>> By this usage of the word "table" I am not speaking of the database
>>>>>> table stored on the server. But the html displayed table on the page.
>>>>>
>>>>> Note that the following is an example that assumes the reader has some
>>>>> competencies and understanding of php, and the use of the ellipsis
>>>>>
>>>>> <?php
>>>>>
>>>>> // Start the table:
>>>>>
>>>>> echo "<table>\n";
>>>>>
>>>>> // print the table header row
>>>>>
>>>>> echo "<tr> <th>header</th>... </tr>\n";
>>>>>
>>>>> // use a loop that fetches every row from the mysqli result // this
>>>>> example assumes the mysqli result is in $result // $data is a local
>>>>> variable in the loop
>>>>>
>>>>> while ($data = mysqli_fetch_assoc($result)) {
>>>>>
>>>>> // in here you write out a single table row for each set of // $data
>>>>> from the query result
>>>>>
>>>>> echo "<tr> <td>{$data['fieldname']}</td>... </tr>\n";
>>>>>
>>>>> }
>>>>>
>>>>> // close the table
>>>>>
>>>>> echo "</table>";
>>>>>
>>>>> ?>
>>>>
>>>> Done that.
>>>> What I get is 11 duplicates of the first item.
>>>> So why does it stop at 11 when I have 200 records?
>>>
>>> Perhaps your query is not fetching the data you think it is. Without 
>>> running your query against your datatable at the mysql command line, it's 
>>> hard to tell.
>>>
>>> I suspect but I can't be sure that the reason you're getting 11 values 
>>> might be linked to the "(year>1959) AND (year<1970)" part of the query.
>>>
>>> There might be an issue if you have stored years as strings and are now 
>>> trying to compare those strings with a numeric value. I'm not sure, 
>>> because I don't usually try to compare strings with numbers in mysql.
>> 
>> I tried using the "between" part and that resulted in displaying "0".
>> 
> 
> Which goes back to Denis's original comment - how is the 'year" column
> defined in your database?

I tried with and without quotes. Same result. Nothing.

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


#15215

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-04-05 14:55 -0400
Message-ID<mfs0dh$35o$1@dont-email.me>
In reply to#15213
On 4/5/2015 11:40 AM, richard wrote:
> On Sun, 05 Apr 2015 11:21:04 -0400, Jerry Stuckle wrote:
> 
>> On 4/5/2015 10:58 AM, richard wrote:
>>> On Sun, 5 Apr 2015 04:47:05 +0000 (UTC), Denis McMahon wrote:
>>>
>>>> On Sat, 04 Apr 2015 19:32:29 -0400, richard wrote:
>>>>
>>>>> On Sat, 4 Apr 2015 23:28:57 +0000 (UTC), Denis McMahon wrote:
>>>>>
>>>>>> On Fri, 03 Apr 2015 21:54:12 -0400, richard wrote:
>>>>>>
>>>>>>> "SELECT * from sixty where (
>>>>>>>   (peak='1')
>>>>>>>   AND  (year>1959)
>>>>>>>   AND  (year<1970)
>>>>>>> ) ORDER BY year, sid "
>>>>>>>
>>>>>>> Considering this code provided by Erwin Moller, how does one now
>>>>>>> display the information?
>>>>>>>
>>>>>>> The standard method of using $row=$result() winds up with only the
>>>>>>> first item ending up in a displayed table while the other items are
>>>>>>> just bunched up together one after the other.
>>>>>>>
>>>>>>> If I simply fetch one item at a time, the table is displayed as
>>>>>>> wanted.
>>>>>>>
>>>>>>> By this usage of the word "table" I am not speaking of the database
>>>>>>> table stored on the server. But the html displayed table on the page.
>>>>>>
>>>>>> Note that the following is an example that assumes the reader has some
>>>>>> competencies and understanding of php, and the use of the ellipsis
>>>>>>
>>>>>> <?php
>>>>>>
>>>>>> // Start the table:
>>>>>>
>>>>>> echo "<table>\n";
>>>>>>
>>>>>> // print the table header row
>>>>>>
>>>>>> echo "<tr> <th>header</th>... </tr>\n";
>>>>>>
>>>>>> // use a loop that fetches every row from the mysqli result // this
>>>>>> example assumes the mysqli result is in $result // $data is a local
>>>>>> variable in the loop
>>>>>>
>>>>>> while ($data = mysqli_fetch_assoc($result)) {
>>>>>>
>>>>>> // in here you write out a single table row for each set of // $data
>>>>>> from the query result
>>>>>>
>>>>>> echo "<tr> <td>{$data['fieldname']}</td>... </tr>\n";
>>>>>>
>>>>>> }
>>>>>>
>>>>>> // close the table
>>>>>>
>>>>>> echo "</table>";
>>>>>>
>>>>>> ?>
>>>>>
>>>>> Done that.
>>>>> What I get is 11 duplicates of the first item.
>>>>> So why does it stop at 11 when I have 200 records?
>>>>
>>>> Perhaps your query is not fetching the data you think it is. Without 
>>>> running your query against your datatable at the mysql command line, it's 
>>>> hard to tell.
>>>>
>>>> I suspect but I can't be sure that the reason you're getting 11 values 
>>>> might be linked to the "(year>1959) AND (year<1970)" part of the query.
>>>>
>>>> There might be an issue if you have stored years as strings and are now 
>>>> trying to compare those strings with a numeric value. I'm not sure, 
>>>> because I don't usually try to compare strings with numbers in mysql.
>>>
>>> I tried using the "between" part and that resulted in displaying "0".
>>>
>>
>> Which goes back to Denis's original comment - how is the 'year" column
>> defined in your database?
> 
> I tried with and without quotes. Same result. Nothing.
> 

Which doesn't answer the question at all.  But you most probably don't
even understand the question.

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

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


#15218

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2015-04-06 02:07 +0000
Message-ID<XnsA473E1082F2C0dougmilmaccom@213.239.209.88>
In reply to#15213
richard <noreply@example.com> wrote in news:13xqlknyrvdkn$.kascoyjwfeg8.dlg@
40tude.net:

> On Sun, 05 Apr 2015 11:21:04 -0400, Jerry Stuckle wrote:
[...]
>> Which goes back to Denis's original comment - how is the 'year" column
>> defined in your database?
> 
> I tried with and without quotes. Same result. Nothing.
> 
And you still haven't answered the question. How is the 'year' column defined in your 
database? Numeric or string?

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


#15217

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2015-04-06 02:05 +0000
Message-ID<XnsA473E0D7A27C3dougmilmaccom@213.239.209.88>
In reply to#15207
richard <noreply@example.com> wrote in news:1xbslhz79f19i.1tpyrouzu9o3f$.dlg@
40tude.net:

> On Sun, 5 Apr 2015 04:47:05 +0000 (UTC), Denis McMahon wrote:
>> I suspect but I can't be sure that the reason you're getting 11 values 
>> might be linked to the "(year>1959) AND (year<1970)" part of the query.
[...]
> 
> I tried using the "between" part and that resulted in displaying "0".
> 
If so, then you did something wrong.

    	WHERE  (year > 1959) AND (year < 1970)

and

    	WHERE (year BETWEEN 1960 AND 1969)

are equivalent -- assuming year has a numeric datatype.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

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


csiph-web