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
Return to the default flat view Create a new topic Submit Reply
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 previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma:
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
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: Tue Nov 26 22:03:33 GMT 2024

Total time taken to generate the page: 0.03852 seconds