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


Groups > comp.lang.php > #10853

Re: part 2 - file exists not working

From Lew Pitcher <lew.pitcher@digitalfreehold.ca>
Subject Re: part 2 - file exists not working
Newsgroups comp.lang.php
References <6tzjiffjaqy6.1rfg283mi0q9m.dlg@40tude.net> <l1qna9$4s1$1@news.albasani.net> <Ct60u.140494$PB4.4300@fx03.iad> <16091ltv3xnv7.h4tb7rm02jdu.dlg@40tude.net>
Organization The Pitcher Digital Freehold
Message-ID <PHg0u.124791$Fo7.16927@fx19.iad> (permalink)
Date 2013-09-24 09:45 -0400

Show all headers | View raw


On Tuesday 24 September 2013 01:57, in comp.lang.php, noreply@example.com
wrote:

> On Mon, 23 Sep 2013 22:07:29 -0400, Lew Pitcher wrote:
> 
>> On Monday 23 September 2013 20:46, in comp.lang.php, me@home.invalid
>> wrote:
>> 
>>> richard wrote:
>>> 
>>>> I am attempting to show a play button when the file actually exists.
>>>> 
>>>> This does pass the test the way it should, however, my test for display
>>>> does not.
>>>> 
>>>> How should I test to make sure a button shows when the file is there
>>>> and show nothing when it isn't?
>>>> 
>>>> 
>>>> 
>>>> $number=1;
>>>> 
>>>> echo '<table border="1">';
>>>> echo "<tr><th>Rank</th><th>Charted -
>>>> Artist</th><th>Play</th><th>Flipside</th><th>Label</th><th>First
>>>> Week</th><th>Peak</th><th>Weeks On Chart</th></tr>";
>>>> 
>>>> while ($number<=100){
>>>> $result = mysql_query("SELECT atitle,btitle,artist,label,avid,bvid FROM
>>>> A$year WHERE id = $number");
>>> <SNIP>
>>> 
>>> Why on earth are you sending _100_ separate mysql queries when you could
>>> do it with one query using BETWEEN ???
>> 
>> Perhaps he wants his results in ascending sequence by id, and doesn't
>> know about the ORDER BY clause.
>> 
>> $result = mysql_query("SELECT atitle,btitle,artist,label,avid,bvid "
>>                       "FROM A$year "
>>                       "WHERE id BETWEEN 1 and 100 "
>>                       "ORDER BY id ASC");
> 
> Thanks for the clue.
> As given, I got a parse error. Eliminated the extra quotes.

Yah, sorry. I wrote that php, thinking in C. I forgot the string
concatenation operator between each quote.

> Output reseulted in one table row showing with no data.
> 
> www.mroldies.met/filetest.php

If $result is not FALSE, you loop through it using mysql_fetch_array() or
one of it's child functions (mysql_fetch_row or mysql_fetch_assoc()) to
retrieve individual rows

Something like

  while ($row = mysql_fetch_array($result) )
  {
    printf("atitle: %s\n",$row['atitle']);
    printf("btitle: %s\n",$row['btitle']);
    /* and so on */
  }


-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request

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


Thread

part 2 - file exists not working richard <noreply@example.com> - 2013-09-23 10:04 -0400
  Re: part 2 - file exists not working Tim Streater <timstreater@greenbee.net> - 2013-09-23 15:17 +0100
    Re: part 2 - file exists not working richard <noreply@example.com> - 2013-09-23 10:35 -0400
  Re: part 2 - file exists not working Paul Herber <paul@pherber.com> - 2013-09-23 15:33 +0100
  Re: part 2 - file exists not working David Robley <me@home.invalid> - 2013-09-24 10:16 +0930
    Re: part 2 - file exists not working Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-09-23 22:07 -0400
      Re: part 2 - file exists not working richard <noreply@example.com> - 2013-09-24 01:57 -0400
        Re: part 2 - file exists not working David Robley <me@home.invalid> - 2013-09-24 17:19 +0930
          Re: part 2 - file exists not working richard <noreply@example.com> - 2013-09-24 04:10 -0400
          Re: part 2 - file exists not working richard <noreply@example.com> - 2013-09-24 04:32 -0400
          Re: part 2 - file exists not working Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-09-24 23:23 +0000
            Re: part 2 - file exists not working David Robley <me@home.invalid> - 2013-09-25 09:48 +0930
        Re: part 2 - file exists not working Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-09-24 09:45 -0400
          Re: part 2 - file exists not working Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-24 16:34 +0200
            Re: part 2 - file exists not working Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-09-24 10:41 -0400
              Re: part 2 - file exists not working richard <noreply@example.com> - 2013-09-24 12:17 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-24 09:29 -0700
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-24 18:51 -0400
                Re: part 2 - file exists not working Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-24 19:10 +0000
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-24 19:08 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-24 18:39 -0700
                Re: part 2 - file exists not working "Peter H. Coffin" <hellsop@ninehells.com> - 2013-09-24 22:17 -0500
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-26 17:20 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-26 15:43 -0700
                Re: part 2 - file exists not working Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-26 19:43 -0400
                Re: part 2 - file exists not working Scott Johnson <noonehome@chalupasworld.com> - 2013-09-24 18:54 -0700
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-26 17:39 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-26 15:47 -0700
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-28 13:58 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-28 11:45 -0700
                Re: part 2 - file exists not working Tim Streater <timstreater@greenbee.net> - 2013-09-25 09:01 +0100
              Re: part 2 - file exists not working Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-09-24 18:54 +0200
                Re: part 2 - file exists not working Tim Streater <timstreater@greenbee.net> - 2013-09-24 18:30 +0100
              Re: part 2 - file exists not working Scott Johnson <noonehome@chalupasworld.com> - 2013-09-24 15:40 -0700
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-24 19:14 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-24 18:43 -0700
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-26 17:42 -0400
              Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-24 18:50 -0400
                Re: part 2 - file exists not working Scott Johnson <noonehome@chalupasworld.com> - 2013-09-24 18:56 -0700
                Re: part 2 - file exists not working Curtis Dyer <dyer85@gmail.com> - 2013-09-26 06:01 +0000
                Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-26 18:04 -0400
                Re: part 2 - file exists not working Curtis Dyer <dyer85@gmail.com> - 2013-09-27 01:47 +0000
                Re: part 2 - file exists not working Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-26 22:56 -0400
                Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-26 20:11 -0700
                Re: part 2 - file exists not working Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-26 23:41 -0400
                Re: part 2 - file exists not working Curtis Dyer <dyer85@gmail.com> - 2013-09-27 06:04 +0000
                OT Re: part 2 - file exists not working Twayne <nobody@spamcop.net> - 2013-09-28 14:33 -0400
                Re: OT Re: part 2 - file exists not working Fiver <numeralfive@gmail.com> - 2013-09-28 23:12 +0200
                Re: OT Re: part 2 - file exists not working The Natural Philosopher <tnp@invalid.invalid> - 2013-09-29 06:50 +0100
                Re: OT Re: part 2 - file exists not working "Peter H. Coffin" <hellsop@ninehells.com> - 2013-09-29 10:39 -0500
                Re: OT Re: part 2 - file exists not working Jerry Stuckle <jstucklex@attglobal.net> - 2013-09-29 14:49 -0400
  Re: part 2 - file exists not working Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-09-24 23:20 +0000
    Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-24 18:46 -0700
    Re: part 2 - file exists not working richard <noreply@example.com> - 2013-09-24 22:27 -0400
      Re: part 2 - file exists not working The Natural Philosopher <tnp@invalid.invalid> - 2013-09-25 06:21 +0100
      Re: part 2 - file exists not working David Robley <me@home.invalid> - 2013-09-25 15:20 +0930
        Re: part 2 - file exists not working Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-09-26 20:30 +0000
    Re: part 2 - file exists not working Denis McMahon <denismfmcmahon@gmail.com> - 2013-09-25 07:42 +0000
      Re: part 2 - file exists not working The Natural Philosopher <tnp@invalid.invalid> - 2013-09-25 09:07 +0100
        Re: part 2 - file exists not working Richard Yates <richard@yatesguitar.com> - 2013-09-25 06:29 -0700
          Re: part 2 - file exists not working The Natural Philosopher <tnp@invalid.invalid> - 2013-09-25 15:09 +0100

csiph-web