Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10837 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-09-23 10:04 -0400 |
| Last post | 2013-09-25 15:09 +0100 |
| Articles | 20 on this page of 61 — 16 participants |
Back to article view | Back to comp.lang.php
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
Page 1 of 4 [1] 2 3 4 Next page →
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-23 10:04 -0400 |
| Subject | part 2 - file exists not working |
| Message-ID | <6tzjiffjaqy6.1rfg283mi0q9m.dlg@40tude.net> |
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");
if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; }
$info = mysql_fetch_row($result);
$go="";
$asong=$info[4];
$filename = 'audio/'.$year.'/'.$asong.'.mp3';
if (file_exists($filename)) {$go="go";}
else { $go="stop";}
echo "<tr>";
echo "<td class='rank'>$number</td>";
echo "<td class='atd'><div class='aname'>$info[0]</div><br/>$info[2]</td>";
echo "<td>";
if ($go="go") {echo "x";}
echo "<a href=\"http://mroldies.net/player.php?year=$year&nid=$number\"
rel='ajaxpanel' data-loadtype='iframe'><img
src='http://mroldies.net/playbutton2.gif'></a>";
echo "</td>";
echo "<td class='atd'>$info[1]</td>";
echo "<td class='btd'>$info[3]</td>";
echo "</tr>\n";
$number++;
}
echo '</table>';
[toc] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-09-23 15:17 +0100 |
| Message-ID | <timstreater-D1288C.15175823092013@news.individual.net> |
| In reply to | #10837 |
In article <6tzjiffjaqy6.1rfg283mi0q9m.dlg@40tude.net>,
richard <noreply@example.com> 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");
> if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; }
> $info = mysql_fetch_row($result);
>
> $go="";
> $asong=$info[4];
> $filename = 'audio/'.$year.'/'.$asong.'.mp3';
>
> if (file_exists($filename)) {$go="go";}
> else { $go="stop";}
>
> echo "<tr>";
> echo "<td class='rank'>$number</td>";
> echo "<td class='atd'><div class='aname'>$info[0]</div><br/>$info[2]</td>";
> echo "<td>";
> if ($go="go") {echo "x";}
== not =
> echo "<a href=\"http://mroldies.net/player.php?year=$year&nid=$number\"
> rel='ajaxpanel' data-loadtype='iframe'><img
> src='http://mroldies.net/playbutton2.gif'></a>";
> echo "</td>";
> echo "<td class='atd'>$info[1]</td>";
> echo "<td class='btd'>$info[3]</td>";
> echo "</tr>\n";
>
> $number++;
> }
>
> echo '</table>';
One thing I learnt 40 years ago is that a shitty layout makes it a lot
harder to spot errors.
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-23 10:35 -0400 |
| Message-ID | <1vz6yfuihfcmo.pos6fuw3g7gr$.dlg@40tude.net> |
| In reply to | #10838 |
thanks. that worked just fine.
[toc] | [prev] | [next] | [standalone]
| From | Paul Herber <paul@pherber.com> |
|---|---|
| Date | 2013-09-23 15:33 +0100 |
| Message-ID | <77k049dhfjcqnapat91a7ppm27vuu2k7v0@news.eternal-september.org> |
| In reply to | #10837 |
On Mon, 23 Sep 2013 10:04:50 -0400, richard <noreply@example.com> wrote:
>$filename = 'audio/'.$year.'/'.$asong.'.mp3';
>
>if (file_exists($filename)) {$go="go";}
> else { $go="stop";}
Is the file under the webserver root. If not then it won't work.
>echo "<tr>";
>echo "<td class='rank'>$number</td>";
>echo "<td class='atd'><div class='aname'>$info[0]</div><br/>$info[2]</td>";
>echo "<td>";
>if ($go="go") {echo "x";}
Here is the mistake. This is assigning "go" to $go
--
Regards, Paul Herber, Sandrila Ltd.
http://www.sandrila.co.uk/ twitter: @sandrilaLtd
[toc] | [prev] | [next] | [standalone]
| From | David Robley <me@home.invalid> |
|---|---|
| Date | 2013-09-24 10:16 +0930 |
| Message-ID | <l1qna9$4s1$1@news.albasani.net> |
| In reply to | #10837 |
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 ???
--
Cheers
David Robley
The strength of women is psychology cannot explain them.
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2013-09-23 22:07 -0400 |
| Message-ID | <Ct60u.140494$PB4.4300@fx03.iad> |
| In reply to | #10845 |
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");
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-24 01:57 -0400 |
| Message-ID | <16091ltv3xnv7.h4tb7rm02jdu.dlg@40tude.net> |
| In reply to | #10846 |
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.
Output reseulted in one table row showing with no data.
www.mroldies.met/filetest.php
[toc] | [prev] | [next] | [standalone]
| From | David Robley <me@home.invalid> |
|---|---|
| Date | 2013-09-24 17:19 +0930 |
| Message-ID | <l1rg3c$ej1$1@news.albasani.net> |
| In reply to | #10847 |
richard 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.
> Output reseulted in one table row showing with no data.
>
> www.mroldies.met/filetest.php
You do of course realise that you handle the returned result set by looping
over it to get all the results? Please see
http://www.php.net/manual/en/function.mysql-fetch-assoc.php which should
give you a few tips on working with a result set of multiple records.
You might have to rethink your code a little to get the correct display
format.
--
Cheers
David Robley
How come there's only one Monopolies Commission?
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-24 04:10 -0400 |
| Message-ID | <1spzexheue1eh.qttet8vgh58j$.dlg@40tude.net> |
| In reply to | #10849 |
On Tue, 24 Sep 2013 17:19:28 +0930, David Robley wrote:
> richard 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.
>> Output reseulted in one table row showing with no data.
>>
>> www.mroldies.met/filetest.php
>
> You do of course realise that you handle the returned result set by looping
> over it to get all the results? Please see
> http://www.php.net/manual/en/function.mysql-fetch-assoc.php which should
> give you a few tips on working with a result set of multiple records.
>
> You might have to rethink your code a little to get the correct display
> format.
interesting idea I will try it.
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-24 04:32 -0400 |
| Message-ID | <1rvpxfyg5eojk.boeua9gzk06p.dlg@40tude.net> |
| In reply to | #10849 |
On Tue, 24 Sep 2013 17:19:28 +0930, David Robley wrote:
> richard 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.
>> Output reseulted in one table row showing with no data.
>>
>> www.mroldies.met/filetest.php
>
> You do of course realise that you handle the returned result set by looping
> over it to get all the results? Please see
> http://www.php.net/manual/en/function.mysql-fetch-assoc.php which should
> give you a few tips on working with a result set of multiple records.
>
> You might have to rethink your code a little to get the correct display
> format.
http://mroldies.net/fetchit.php
slick
[toc] | [prev] | [next] | [standalone]
| From | Doug Miller <doug_at_milmac_dot_com@example.com> |
|---|---|
| Date | 2013-09-24 23:23 +0000 |
| Message-ID | <XnsA245C50E54052dougmilmaccom@78.46.70.116> |
| In reply to | #10849 |
David Robley <me@home.invalid> wrote in news:l1rg3c$ej1$1@news.albasani.net: > You do of course realise that you handle the returned result set by looping > over it to get all the results? You're new here, aren't you. NO, he doesn't realize that. He's been nicknamed "RtS" (for "Richard the Stupid") for good reason. Google him.
[toc] | [prev] | [next] | [standalone]
| From | David Robley <me@home.invalid> |
|---|---|
| Date | 2013-09-25 09:48 +0930 |
| Message-ID | <l1ta2f$2va$1@news.albasani.net> |
| In reply to | #10868 |
Doug Miller wrote: > David Robley <me@home.invalid> wrote in > news:l1rg3c$ej1$1@news.albasani.net: > >> You do of course realise that you handle the returned result set by >> looping over it to get all the results? > > You're new here, aren't you. No. I've been here occasionally throwing my $0.02 in for a long time. > > NO, he doesn't realize that. He's been nicknamed "RtS" (for "Richard the > Stupid") for good reason. Google him. -- Cheers David Robley "I used to own this gold mine!" Tom exclaimed.
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2013-09-24 09:45 -0400 |
| Message-ID | <PHg0u.124791$Fo7.16927@fx19.iad> |
| In reply to | #10847 |
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
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-09-24 16:34 +0200 |
| Message-ID | <2620287.ckb7lz7aL7@PointedEars.de> |
| In reply to | #10853 |
Lew Pitcher wrote:
> noreply@example.com wrote:
>> 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 */
> }
JFTR: The mysql extension is *deprecated* and will be *removed*:
<http://php.net/mysql_fetch_array>
Use mysqli or pdo_mysql instead.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
[toc] | [prev] | [next] | [standalone]
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Date | 2013-09-24 10:41 -0400 |
| Message-ID | <awh0u.124795$Fo7.114268@fx19.iad> |
| In reply to | #10854 |
On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars@web.de
wrote:
> Lew Pitcher wrote:
>
>> noreply@example.com wrote:
>>> 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 */
>> }
>
> JFTR: The mysql extension is *deprecated* and will be *removed*:
>
> <http://php.net/mysql_fetch_array>
A very valid point that we've repeatedly made to richard. And that he has
considered and rejected.
> Use mysqli or pdo_mysql instead.
Agreed.
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
[toc] | [prev] | [next] | [standalone]
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-09-24 12:17 -0400 |
| Message-ID | <1avjnj81i7h58$.tpbaqs9y1nv8.dlg@40tude.net> |
| In reply to | #10855 |
On Tue, 24 Sep 2013 10:41:09 -0400, Lew Pitcher wrote:
> On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars@web.de
> wrote:
>
>> Lew Pitcher wrote:
>>
>>> noreply@example.com wrote:
>>>> 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 */
>>> }
>>
>> JFTR: The mysql extension is *deprecated* and will be *removed*:
>>
>> <http://php.net/mysql_fetch_array>
>
> A very valid point that we've repeatedly made to richard. And that he has
> considered and rejected.
>
>> Use mysqli or pdo_mysql instead.
>
> Agreed.
I will change when my host changes.
As the host is responsible for maintaining the server side, I can't do a
damn thing until they do.
[toc] | [prev] | [next] | [standalone]
| From | Richard Yates <richard@yatesguitar.com> |
|---|---|
| Date | 2013-09-24 09:29 -0700 |
| Message-ID | <2af349p29t5i5nqe2nqei8m9pnfnnbisqq@4ax.com> |
| In reply to | #10856 |
On Tue, 24 Sep 2013 12:17:23 -0400, richard <noreply@example.com> wrote: >>> JFTR: The mysql extension is *deprecated* and will be *removed*: >>> >>> <http://php.net/mysql_fetch_array> >> >> A very valid point that we've repeatedly made to richard. And that he has >> considered and rejected. >> >>> Use mysqli or pdo_mysql instead. >> >> Agreed. > >I will change when my host changes. >As the host is responsible for maintaining the server side, I can't do a >damn thing until they do. Are you saying that the host does not provide the mysqli extension? That seems very unlikely. Who is the host?
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-09-24 18:51 -0400 |
| Message-ID | <l1t50t$2r0$2@speranza.aioe.org> |
| In reply to | #10857 |
On 2013-09-24 12:29 PM, Richard Yates wrote: > On Tue, 24 Sep 2013 12:17:23 -0400, richard <noreply@example.com> > wrote: > >>>> JFTR: The mysql extension is *deprecated* and will be *removed*: >>>> >>>> <http://php.net/mysql_fetch_array> >>> >>> A very valid point that we've repeatedly made to richard. And that he has >>> considered and rejected. >>> >>>> Use mysqli or pdo_mysql instead. >>> >>> Agreed. >> >> I will change when my host changes. >> As the host is responsible for maintaining the server side, I can't do a >> damn thing until they do. > > Are you saying that the host does not provide the mysqli extension? > That seems very unlikely. Who is the host? > Heck, even I know what he meant there!
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-09-24 19:10 +0000 |
| Message-ID | <l1so2u$4ob$3@dont-email.me> |
| In reply to | #10856 |
On Tue, 24 Sep 2013 12:17:23 -0400, richard wrote: > I will change when my host changes. > As the host is responsible for maintaining the server side, I can't do a > damn thing until they do. Have you tested to see if mysqli is available on your host? If it is, why are you not using it? mysqli is not something that your hosting server will expect to announce the roll out of, indeed it's quite possible that it's been on the server for several years already. mysql is the internal php name for the old deprecated set of interface functions to the mysql database. mysqli is the internal php name for a similar but better set of interface functions to the mysql database. It is quite possible for both these sets of interface functions to be installed in the same php build. Certainly this is the case in eg PHP Version 5.3.10-1ubuntu3.8 on my server. If you wait until your hosting provider upgrades to a php version that obsoletes mysql, then all your php files that use mysql_* functions will stop working until you rewrite them to use mysqli. If you check now and discover that yes, your server does in fact also support mysqli_* functions already, then you can start migrating your code from mysql_* functions to mysqli_* functions now so that you won't get caught out in a future upgrade. Note that checking doesn't mean you look to see if the database has changed from mysql to mysqli, because that's not what happens. Checking means creating a page called something like sysinfo.php that contains the following code: <?php phpinfo(); and then putting that page in your website, and then going to the url: http://your_website_name_here/sysinfo.php Then scroll down the output until you come to the mysqli section. The presence of this section means that the mysqli interface modules are installed in the servers php code. Hostgator support PHP 5, so their PHP build includes mysqli_* functions. The only thing stopping you using mysqli_* functions instead of mysql_* functions is *YOU*! -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-09-24 19:08 -0400 |
| Message-ID | <l1t61d$562$1@speranza.aioe.org> |
| In reply to | #10860 |
Finally, a voice of some reason instead of scare tactics even if still a little light in areas. On 2013-09-24 3:10 PM, Denis McMahon wrote: > On Tue, 24 Sep 2013 12:17:23 -0400, richard wrote: > >> I will change when my host changes. >> As the host is responsible for maintaining the server side, I can't do a >> damn thing until they do. And that's true. > > Have you tested to see if mysqli is available on your host? I have, yes. I did it by contacting Support and they responded in the same day. And at least with MY host they have a "What's New" page to look for things like that, too. All version updates/upgrades/deletions are mentioned there. > > If it is, why are you not using it? mysqli is not something that your > hosting server will expect to announce the roll out of, indeed it's quite > possible that it's been on the server for several years already. The poster already mentioned why he wasn't using it. Not necessarily in most cases IME at least. Although, if it's avaliable, it's a good move to be checking into what it takes to make the revision IFF it will benefit you. ... > It is quite possible for both these sets of interface functions to be > installed in the same php build. Certainly this is the case in eg PHP > Version 5.3.10-1ubuntu3.8 on my server. Exactly. ... > If you check now and discover that yes, your server does in fact also > support mysqli_* functions already, then you can start migrating your > code from mysql_* functions to mysqli_* functions now so that you won't > get caught out in a future upgrade it Unless it's of no benefit; you already said they may both exist and if that's the case and one gains no benefit from changing, well, ... . > > Note that checking doesn't mean you look to see if the database has > changed from mysql to mysqli, because that's not what happens. Checking > means creating a page called something like sysinfo.php that contains the > following code: > > <?php > phpinfo(); > > and then putting that page in your website, and then going to the url: > > http://your_website_name_here/sysinfo.php > > Then scroll down the output until you come to the mysqli section. The > presence of this section means that the mysqli interface modules are > installed in the servers php code. Good advice. But if someone is so new that phpinfo.php & 'sysinfo' is news to them, well, they've a lot more than mysql to get up to date on. > > Hostgator support PHP 5, so their PHP build includes mysqli_* functions. > The only thing stopping you using mysqli_* functions instead of mysql_* > functions is *YOU*! And a learning curve, and time (which is money), and ... etc. etc.. Nothing is ever gained from advice like that. >
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.php
csiph-web