Code: Select all
$id = $_GET['id'];
$query1 = "SELECT * FROM Players WHERE player_id = $id";
$result1 = mysql_query($query1, $conn);
$filename = "/images/photos/$id.jpg";
if (file_exists($filename)) { TRUE } ELSE {FALSE}Moderator: General Moderators
Code: Select all
$id = $_GET['id'];
$query1 = "SELECT * FROM Players WHERE player_id = $id";
$result1 = mysql_query($query1, $conn);
$filename = "/images/photos/$id.jpg";
if (file_exists($filename)) { TRUE } ELSE {FALSE}Code: Select all
$id = $_GET['id'];
$query1 = "SELECT * FROM Players WHERE player_id = $id";
$result1 = mysql_query($query1, $conn);
$filename = "/images/photos/$id.jpg";
echo $filename;
if (file_exists($filename)) { TRUE } ELSE {FALSE}The path to the files are:Skara wrote:Yeah, file_exists uses the real root, not the website root.
In other words, it would be more like...
/home/yourname/public_html/images/photos/$id.jpg
Code: Select all
$filename = "/images/photos/$id.jpg";Code: Select all
$filename = $_SERVER['DOCUMENT_ROOT']."/images/photos/$id.jpg";Worked like a charm, thanks!Pimptastic wrote:change this line
to...Code: Select all
$filename = "/images/photos/$id.jpg";Code: Select all
$filename = $_SERVER['DOCUMENT_ROOT']."/images/photos/$id.jpg";