Re: file_exists problems
| From: | Prolog | Date: | Sat, 01 Dec 2001 08:19:35 +0000 |
| Subject: | Re: file_exists problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76305@lists.php.net to get a copy of this message | ||
I've since tried that also. It too seems to return the same error. I'm
curious if the file_exists can't use relative positions....like it has to be
in the same folder or you have to use the whole line like c:\.... I'm
working on a box that isn't mine of the net...if that's the case I don't
know my full directory line. Just a thought but I'm not sure. I'll include
my full code below...as it sits now. Maybe you can see something that I
can't.....
-----
<?php
//connect to DB
include ('connect.php');
//Query MySQL DB
$result = mysql_query("SELECT * FROM ar
LEFT JOIN company on ar.company_id=company.company_id
LEFT JOIN scale on ar.scale_id=scale.scale_id
WHERE stock_status = 0
order by ar.driver_number");
//gather results
if ($myrow = mysql_fetch_array($result)) {
//start table
echo "<table border=1>\n";
echo "<tr><td>Image</td><td>Info</td></tr>\n";
do {
//filename is the item number + t.jpg -- t shorthand for thumbnail
$picname = "$itemnumber t.jpg";
print ("<tr><td><center>");
//if the file exists then print it. Otherwise print a generic image saying
it doesn't exist.
if (file_exists ("/images/$picname t.jpt")
{
print ('<img src=\"/images/ . $picname . t.jpt\">');
print ("<center></td><td><center><a
href=\"drivers.php?driver=$dn\"> $dn
</a><br> $sp - $val <br> $size : \$$price<br>Release: $release <br>
<a
href=\"cart.php?item=$itemnumber\">Preorder This
Item</a></center></td></tr>\n");
}
else
{
print ("<img src=\"/images/npat.jpt\">");
print ("<center></td><td><center><a
href=\"drivers.php?driver=$dn\"> $dn
</a><br> $sp - $val <br> $size : \$$price<br>Release: $release <br>
<a
href=\"cart.php?item=$itemnumber\">Preorder This
Item</a></center></td></tr>\n");
}
}
while ($myrow = mysql_fetch_array($result));
print ("</table>\n)";
//if no results found display this message
}
else
{
echo "Sorry, no records were found!";
}
$dn = "$myrow["driver_name"]";
$sp = "$myrow["sponsor"]";
$val = "$myrow["value"]";
$size = "$myrow["size"]";
$price = "$myrow["price"]";
$release = "$myrow["release"]";
$itemnumber = "$myrow[item_number]";
?>
-----
maybe that will help.
-Jordan
"Faeton" <faeton@ua.fm> wrote in message
news:99304451508.20011201094301@ua.fm...
> Hello Prolog,
>
>
> Hm... And what about:
> print '<img src="/images/$filename">';
> instead of readfile?
>
>
> P> if(file_exists(/images/$filename))
> P> {
> P> readfile(/images/$filename);
> P> }
> P> else
> P> {
> P> readfile(images/npat.jpg);
> P> }
>
>
>
> ------------------------------------------------
> Ivan 'Faeton aka xetrix' Danishevsky
> ICQ(240266) faeton@xemichat.com www.xemichat.com
> ::: Ñòîèò òîëüêî çàîñòðèòü âîïðîñ, êàê ñðàçó ïðîñÿò
> çàêðóãëÿòüñÿ. :::
>