3raser Posted June 4, 2010 Share Posted June 4, 2010 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."; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/203887-file-extension/ Share on other sites More sharing options...
TheBG Posted June 4, 2010 Share Posted June 4, 2010 What, exactly is in $image ? Quote Link to comment https://forums.phpfreaks.com/topic/203887-file-extension/#findComment-1067870 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.