webForumDet fria alternativet

Hur fungerar file_exists?

2 svar · 150 visningar · startad av Qonos

QonosMedlem sedan sep. 2000438 inlägg
#1

inte så här iaf :o(

<?php
if(!file_exists($row[id].".jpg"))
echo' <img src="home/'.$row[id].'.jpg" width="80" border="0" alt="" hspace="8" vspace="3"><br>';
?>

FuelMedlem sedan okt. 20001 285 inlägg
#2

Så här kanske ?

<?
$min_bild = $row[id];

if(file_exists($min_bild.jpg")) {
echo " <img src=\"home/$min_ bild.jpg\" width=\"80\" border=\"0\" alt=\"\" hspace=\"8\" vspace=\"3\"><br>";
} else {
echo " <img src=\"home/standard.jpg\" width=\"80\" border=\"0\" alt=\"finns inte\" hspace=\"8\" vspace=\"3\"><br>";
}
?>

------------------
" The code is out there "

QonosMedlem sedan sep. 2000438 inlägg
#3

<?
$min_bild = 'home/'.$row[id].'.jpg';

if(file_exists($min_bild)) {
echo " <img src=\"$min_bild\" width=\"80\" border=\"0\" alt=\"\" hspace=\"8\" vspace=\"3\"><br>";
} else {
echo " <img src=\"home/standard.jpg\" width=\"80\" border=\"0\" alt=\"finns inte\" hspace=\"8\" vspace=\"3\"><br>";
}
?>

fick fixa lite med det, men nu fungerar det... tackar

130 ms totalt · 3 externa anrop · v20260731065814-full.86db40fa
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
127 ms — hämta tråd, inlägg och bilagor (db)