Jump to content

File extension


3raser

Recommended Posts

SOLVED

 

Ok, so I by-passed by other problem by building a whole new system. But now, on the viewing part, I'm trying to including a link to a file in <img src>. But how do I know if it's .png, .jpg, .jpeg, .gif, etc?

 

<?php

require("mysql.php");

//connecting to the database
$connect = mysql_connect("$h","$u","$password") or die("Connection failed!");
mysql_select_db("$db") or die("Database fail!");

if(!$image) {
$image = 1;
}

//extract
$extract = mysql_query("SELECT * FROM photos WHERE photoid='$image'");
$numrows = mysql_num_rows($extract);

while ($row = mysql_fetch_assoc($extract))

{
           $status = $row[status]; 
}

if ($status==1) {
echo "<br><img src='images/". $image ."'.><br>";
} else {
echo "Picture doesn't exist or hasn't been approved.";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/203887-file-extension/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.