FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » part 2 - file exists not working
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
part 2 - file exists not working [message #182875] Mon, 23 September 2013 14:04 Go to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
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&amp;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>';
Re: part 2 - file exists not working [message #182876 is a reply to message #182875] Mon, 23 September 2013 14:17 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net>,
richard <noreply(at)example(dot)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&amp;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
Re: part 2 - file exists not working [message #182877 is a reply to message #182875] Mon, 23 September 2013 14:33 Go to previous messageGo to next message
Paul Herber is currently offline  Paul Herber
Messages: 26
Registered: February 2011
Karma: 0
Junior Member
On Mon, 23 Sep 2013 10:04:50 -0400, richard <noreply(at)example(dot)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
Re: part 2 - file exists not working [message #182878 is a reply to message #182876] Mon, 23 September 2013 14:35 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
thanks. that worked just fine.
Re: part 2 - file exists not working [message #182883 is a reply to message #182875] Tue, 24 September 2013 00:46 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
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.
Re: part 2 - file exists not working [message #182884 is a reply to message #182883] Tue, 24 September 2013 02:07 Go to previous messageGo to next message
Lew Pitcher is currently offline  Lew Pitcher
Messages: 60
Registered: April 2013
Karma: 0
Member
On Monday 23 September 2013 20:46, in comp.lang.php, me(at)home(dot)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
Re: part 2 - file exists not working [message #182885 is a reply to message #182884] Tue, 24 September 2013 05:57 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Mon, 23 Sep 2013 22:07:29 -0400, Lew Pitcher wrote:

> On Monday 23 September 2013 20:46, in comp.lang.php, me(at)home(dot)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
Re: part 2 - file exists not working [message #182887 is a reply to message #182885] Tue, 24 September 2013 07:49 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
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(at)home(dot)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?
Re: part 2 - file exists not working [message #182888 is a reply to message #182887] Tue, 24 September 2013 08:10 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
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(at)home(dot)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.
Re: part 2 - file exists not working [message #182889 is a reply to message #182887] Tue, 24 September 2013 08:32 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
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(at)home(dot)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
Re: part 2 - file exists not working [message #182891 is a reply to message #182885] Tue, 24 September 2013 13:45 Go to previous messageGo to next message
Lew Pitcher is currently offline  Lew Pitcher
Messages: 60
Registered: April 2013
Karma: 0
Member
On Tuesday 24 September 2013 01:57, in comp.lang.php, noreply(at)example(dot)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(at)home(dot)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
Re: part 2 - file exists not working [message #182892 is a reply to message #182891] Tue, 24 September 2013 14:34 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Lew Pitcher wrote:

> noreply(at)example(dot)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
Re: part 2 - file exists not working [message #182893 is a reply to message #182892] Tue, 24 September 2013 14:41 Go to previous messageGo to next message
Lew Pitcher is currently offline  Lew Pitcher
Messages: 60
Registered: April 2013
Karma: 0
Member
On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars(at)web(dot)de
wrote:

> Lew Pitcher wrote:
>
>> noreply(at)example(dot)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
Re: part 2 - file exists not working [message #182894 is a reply to message #182893] Tue, 24 September 2013 16:17 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 24 Sep 2013 10:41:09 -0400, Lew Pitcher wrote:

> On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars(at)web(dot)de
> wrote:
>
>> Lew Pitcher wrote:
>>
>>> noreply(at)example(dot)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.
Re: part 2 - file exists not working [message #182895 is a reply to message #182894] Tue, 24 September 2013 16:29 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Tue, 24 Sep 2013 12:17:23 -0400, richard <noreply(at)example(dot)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?
Re: part 2 - file exists not working [message #182896 is a reply to message #182893] Tue, 24 September 2013 16:54 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
Lew Pitcher wrote:

> [Thomas 'PointedEars' Lahn] wrote:
>> Lew Pitcher wrote:
>>> noreply(at)example(dot)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.
^^^^^^^
Unfortunately, *that* explains a lot. I have the OP killfiled for address
munging and was not aware of that.

(This was also due to your rather uncommon practice of not including the
name in the attribution line at all, which I would advise against. Postings
are written by *people*, not e-mail addresses. An e-mail address signifies
almost nothing; in the From header field value, it may even specify a
mailbox that is heavy spam-filtered and seldom read, not suitable for
contacting the author. And please skip the attribution novel while you are
at it; it does not make sense, and it makes discussions a lot harder to
read, to duplicate non-essential header information there.

<http://www.netmeister.org/news/learn2quote.html/>)

> And that he has considered and rejected.

Still, IMHO all examples should be written according to what one considers
best common practice. At least they can serve as a recommendation to
others. Bad examples to fix original code are almost as bad as bad original
code. A Usenet posting is written once, but then is distributed, and
archived; thus it is still found much later, and read many times in total,
not only by the OP.

>> Use mysqli or pdo_mysql instead.
>
> Agreed.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
Re: part 2 - file exists not working [message #182897 is a reply to message #182896] Tue, 24 September 2013 17:30 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <13286076(dot)b1rK9CuggJ(at)PointedEars(dot)de>,
Thomas 'PointedEars' Lahn <PointedEars(at)web(dot)de> wrote:

> Lew Pitcher wrote:

[snipped]

> And please skip the attribution novel while you are
> at it; it does not make sense, and it makes discussions a lot harder to
> read, to duplicate non-essential header information there.

You may safely ignore PointyHead's complaints about attribution lines.
It's one of his little mental glitches that he will no doubt do
something about one day.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: part 2 - file exists not working [message #182898 is a reply to message #182894] Tue, 24 September 2013 19:10 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
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(at)gmail(dot)com
Re: part 2 - file exists not working [message #182900 is a reply to message #182893] Tue, 24 September 2013 22:40 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 9/24/2013 7:41 AM, Lew Pitcher wrote:
> On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars(at)web(dot)de
> wrote:
>
>> Lew Pitcher wrote:
>>
>>> noreply(at)example(dot)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.
>

Yeah I made that mistake of banging my head against that wall a month or
so ago.

I also believe it was at the same time trying to explain how to step
thru a mysql result set.

Here we are again.
Re: part 2 - file exists not working [message #182901 is a reply to message #182893] Tue, 24 September 2013 22:50 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 2013-09-24 10:41 AM, Lew Pitcher wrote:
> On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars(at)web(dot)de
> wrote:
>
>> Lew Pitcher wrote:
>>
>>> noreply(at)example(dot)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.
>

Mmm, not so valid; it's going to be a good long time before it's
deprecated on most servers. What's always neglected with that little
bit of wisdom is IN WHAT is it being deprecated and when is it expected
to be all that's available? Hell, many sites are still offering a choice
of versions, usually 2, sometimes 3.

The scare tactics are silly and that's why people don't worry about it.
Re: part 2 - file exists not working [message #182902 is a reply to message #182895] Tue, 24 September 2013 22:51 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 2013-09-24 12:29 PM, Richard Yates wrote:
> On Tue, 24 Sep 2013 12:17:23 -0400, richard <noreply(at)example(dot)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!
Re: part 2 - file exists not working [message #182903 is a reply to message #182898] Tue, 24 September 2013 23:08 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
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.


>
Re: part 2 - file exists not working [message #182904 is a reply to message #182900] Tue, 24 September 2013 23:14 Go to previous messageGo to next message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma: 0
Senior Member
On 2013-09-24 6:40 PM, Scott Johnson wrote:
....
>>>
>>> JFTR: The mysql extension is *deprecated* and will be *removed*:

Simple scare tactics from over-sized egos. It's silly.

>>>
....
> Yeah I made that mistake of banging my head against that wall a month or
> so ago.
>
> I also believe it was at the same time trying to explain how to step
> thru a mysql result set.
>
> Here we are again.
Re: part 2 - file exists not working [message #182905 is a reply to message #182875] Tue, 24 September 2013 23:20 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
richard <noreply(at)example(dot)com> wrote in news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:

> if ($go="go") {echo "x";}

Richard, how many times is this now that someone has had to remind you of the difference
between = and == ?
Re: part 2 - file exists not working [message #182906 is a reply to message #182887] Tue, 24 September 2013 23:23 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
David Robley <me(at)home(dot)invalid> wrote in news:l1rg3c$ej1$1(at)news(dot)albasani(dot)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.
Re: part 2 - file exists not working [message #182907 is a reply to message #182906] Wed, 25 September 2013 00:18 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
Doug Miller wrote:

> David Robley <me(at)home(dot)invalid> wrote in
> news:l1rg3c$ej1$1(at)news(dot)albasani(dot)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.
Re: part 2 - file exists not working [message #182908 is a reply to message #182903] Wed, 25 September 2013 01:39 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Tue, 24 Sep 2013 19:08:22 -0400, Twayne <nobody(at)spamcop(dot)net> wrote:

>> 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, ... .

At some point there definitely will be a benefit - that all his pages
continue to work at all. mysql will be discontinued although no one
knows just when. If he waits too long he will be stuck and it may take
weeks for him to make the changes.

I converted all my mysql to mysqli this year - a couple hundred pages.
It was not a trivial chore. Some changes could be automated and some
could not. Some functions are a simple search-and-replace, some are
only similar, and some are a lot different.
Re: part 2 - file exists not working [message #182909 is a reply to message #182904] Wed, 25 September 2013 01:43 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Tue, 24 Sep 2013 19:14:09 -0400, Twayne <nobody(at)spamcop(dot)net> wrote:

> On 2013-09-24 6:40 PM, Scott Johnson wrote:
> ...
>>>>
>>>> JFTR: The mysql extension is *deprecated* and will be *removed*:
>
> Simple scare tactics from over-sized egos. It's silly.

Huh? Can you explain that? The warnings from the folks that decide
seem clear enough: http://www.php.net/mysql_query

How is that a scare tactic or about over-sized egos?
Re: part 2 - file exists not working [message #182910 is a reply to message #182905] Wed, 25 September 2013 01:46 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Tue, 24 Sep 2013 23:20:58 +0000 (UTC), Doug Miller
<doug_at_milmac_dot_com(at)example(dot)com> wrote:

> richard <noreply(at)example(dot)com> wrote in news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>
>> if ($go="go") {echo "x";}
>
> Richard, how many times is this now that someone has had to remind you of the difference
> between = and == ?

Please spell his name correctly ("richard").

Richard
(Who also makes the same coding error often enough, but not publicly,
so far.)
Re: part 2 - file exists not working [message #182911 is a reply to message #182903] Wed, 25 September 2013 01:54 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 9/24/2013 4:08 PM, Twayne wrote:
> 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.

Probably not in the context of using mysqli over mysql.
The host gives you both options (unless you have some budget host in
which case the jokes on him) UNTIL they switch to the version in which
the mysql_ is deprecated and your site breaks.

>
>>
>> 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.

I am pretty sure he was talking to Richard.


>>
>> 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.

The benefit would be your site does not break once the php version
deprecates the currently used functions.

There is a solid reason that the manual says you should NOT be using it
since it will not exist in the future.

> ...
>> 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.

It exists not so you can build a new site upon it. It does so to allow
those who in the past had only that function and gives them reasonable
amount of time to switch to the new one.

>
> ...
>> 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, ... .

Again we are not talking about the benefit of memory or speed or ease of
programming, the benefit is that you site keeps working. A pretty solid
benefit if you ask me or you just end up having a hard drive full of
useless files.

>>
>> 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.

This is the one statement that I agree on with a but. We have pointed
out the function that is going bye bye and gave links on how to use the
new one which does not differ all too much from the former in the
context of the OPs question. If that is too difficult then I do think
we (he) is going to and has had a long frustrating journey.

>>
>> 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.

In all professions you have to stay current with new way of doing things
and toss the old.

You have to learn how to keep up to date with the server needs, it is
part of the job. And by keeping up to date, your site is less likely to
break and cause even more money when you have a down site and still have
to find where it broke and also to learn the new functions anyhow.

Why not do it while the site is still functioning and no one public is
the wiser.
Re: part 2 - file exists not working [message #182912 is a reply to message #182901] Wed, 25 September 2013 01:56 Go to previous messageGo to next message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
On 9/24/2013 3:50 PM, Twayne wrote:
> On 2013-09-24 10:41 AM, Lew Pitcher wrote:
>> On Tuesday 24 September 2013 10:34, in comp.lang.php, PointedEars(at)web(dot)de
>> wrote:
>>
>>> Lew Pitcher wrote:
>>>
>>>> noreply(at)example(dot)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.
>>
>
> Mmm, not so valid; it's going to be a good long time before it's
> deprecated on most servers. What's always neglected with that little
> bit of wisdom is IN WHAT is it being deprecated and when is it expected
> to be all that's available? Hell, many sites are still offering a choice
> of versions, usually 2, sometimes 3.
>
> The scare tactics are silly and that's why people don't worry about it.
>
>

Which programmers (people) would that be?
Re: part 2 - file exists not working [message #182913 is a reply to message #182905] Wed, 25 September 2013 02:27 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 24 Sep 2013 23:20:58 +0000 (UTC), Doug Miller wrote:

> richard <noreply(at)example(dot)com> wrote in news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>
>> if ($go="go") {echo "x";}
>
> Richard, how many times is this now that someone has had to remind you of the difference
> between = and == ?


because it is one of those little things I keep forgetting.
Like a ; or some other minor syntax error.
Re: part 2 - file exists not working [message #182915 is a reply to message #182908] Wed, 25 September 2013 03:17 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On Tue, 24 Sep 2013 18:39:49 -0700, Richard Yates wrote:
> At some point there definitely will be a benefit - that all his pages
> continue to work at all. mysql will be discontinued although no one
> knows just when. If he waits too long he will be stuck and it may take
> weeks for him to make the changes.

(This presumes his project ever gets to the state of "working" in the
first place.)

--
The greatest dangers to liberty lurk in insidious encroachment by men of
zeal, well-meaning but without understanding. -Justice Louis D. Brandeis
Re: part 2 - file exists not working [message #182919 is a reply to message #182913] Wed, 25 September 2013 05:21 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 25/09/13 03:27, richard wrote:
> On Tue, 24 Sep 2013 23:20:58 +0000 (UTC), Doug Miller wrote:
>
>> richard <noreply(at)example(dot)com> wrote in news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>>
>>> if ($go="go") {echo "x";}
>>
>> Richard, how many times is this now that someone has had to remind you of the difference
>> between = and == ?
>
>
> because it is one of those little things I keep forgetting.
> Like a ; or some other minor syntax error.
>
why domnt you remember that you forget these things and check for them
FIRST like everyone else does.

--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: part 2 - file exists not working [message #182920 is a reply to message #182913] Wed, 25 September 2013 05:50 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
richard wrote:

> On Tue, 24 Sep 2013 23:20:58 +0000 (UTC), Doug Miller wrote:
>
>> richard <noreply(at)example(dot)com> wrote in
>> news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>>
>>> if ($go="go") {echo "x";}
>>
>> Richard, how many times is this now that someone has had to remind you of
>> the difference between = and == ?
>
>
> because it is one of those little things I keep forgetting.
> Like a ; or some other minor syntax error.

Here is a tip for you to manage this particular problem - reverse the order
of the test values; if you forget an = you'll trigger a syntax error.

if ("go" = $go) {echo "x";} // triggers an error
if ("go" == $go) {echo "x";} // works as expected

--
Cheers
David Robley

System halted. There is NOTHING you can do.
Re: part 2 - file exists not working [message #182921 is a reply to message #182905] Wed, 25 September 2013 07:42 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Tue, 24 Sep 2013 23:20:58 +0000, Doug Miller wrote:

> richard <noreply(at)example(dot)com> wrote in
> news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>
>> if ($go="go") {echo "x";}
>
> Richard, how many times is this now that someone has had to remind you
> of the difference between = and == ?

I would try and count it, but I'm constrained by a 128 bit adder.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: part 2 - file exists not working [message #182922 is a reply to message #182903] Wed, 25 September 2013 08:01 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <l1t61d$562$1(at)speranza(dot)aioe(dot)org>,
Twayne <nobody(at)spamcop(dot)net> wrote:

> 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:

>> 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, ... .

The benefit is that it's one more issue you can then forget about. It's
one more thing that is not going to suddenly and without warning trip
you up when you don't expect it. You won't then find yourself having to
recode a load of stuff under pressure with perhaps the phone ringing off
the hook asking WTF is going on and when will it be fixed.

Unless you enjoy such situations, of course. But I think any manager
would look sideways at someone who allowed such a situation to develop
when they could have easily avoided it. That someone might then find
themselves with a shiny new P45.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: part 2 - file exists not working [message #182923 is a reply to message #182921] Wed, 25 September 2013 08:07 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 25/09/13 08:42, Denis McMahon wrote:
> On Tue, 24 Sep 2013 23:20:58 +0000, Doug Miller wrote:
>
>> richard <noreply(at)example(dot)com> wrote in
>> news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>>
>>> if ($go="go") {echo "x";}
>>
>> Richard, how many times is this now that someone has had to remind you
>> of the difference between = and == ?
>
> I would try and count it, but I'm constrained by a 128 bit adder.
>
That's better than being bitten 128 times by an adder.

--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Re: part 2 - file exists not working [message #182924 is a reply to message #182923] Wed, 25 September 2013 13:29 Go to previous messageGo to next message
Richard Yates is currently offline  Richard Yates
Messages: 86
Registered: September 2013
Karma: 0
Member
On Wed, 25 Sep 2013 09:07:13 +0100, The Natural Philosopher
<tnp(at)invalid(dot)invalid> wrote:

> On 25/09/13 08:42, Denis McMahon wrote:
>> On Tue, 24 Sep 2013 23:20:58 +0000, Doug Miller wrote:
>>
>>> richard <noreply(at)example(dot)com> wrote in
>>> news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>>>
>>>> if ($go="go") {echo "x";}
>>>
>>> Richard, how many times is this now that someone has had to remind you
>>> of the difference between = and == ?
>>
>> I would try and count it, but I'm constrained by a 128 bit adder.
>>
> That's better than being bitten 128 times by an adder.

Except that adders do not constrain. Constrictors do. So he might
better have said "but I'm constrained by a long Python."
Re: part 2 - file exists not working [message #182925 is a reply to message #182924] Wed, 25 September 2013 14:09 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 25/09/13 14:29, Richard Yates wrote:
> On Wed, 25 Sep 2013 09:07:13 +0100, The Natural Philosopher
> <tnp(at)invalid(dot)invalid> wrote:
>
>> On 25/09/13 08:42, Denis McMahon wrote:
>>> On Tue, 24 Sep 2013 23:20:58 +0000, Doug Miller wrote:
>>>
>>>> richard <noreply(at)example(dot)com> wrote in
>>>> news:6tzjiffjaqy6(dot)1rfg283mi0q9m(dot)dlg(at)40tude(dot)net:
>>>>
>>>> > if ($go="go") {echo "x";}
>>>>
>>>> Richard, how many times is this now that someone has had to remind you
>>>> of the difference between = and == ?
>>>
>>> I would try and count it, but I'm constrained by a 128 bit adder.
>>>
>> That's better than being bitten 128 times by an adder.
>
> Except that adders do not constrain. Constrictors do. So he might
> better have said "but I'm constrained by a long Python."
>
anyone who programs in python is constrained


--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
Pages (2): [1  2    »]  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: [urgent] need solution of Questions, in context of PHP5
Next Topic: Host recommendations (slightly OT)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 17:02:11 GMT 2024

Total time taken to generate the page: 0.02897 seconds