angelali Posted May 20, 2012 Share Posted May 20, 2012 I made an upload image system, the images are stored in a folder, while the image name is stored in database. When I try to execute the image name, it works successfully, but when I try to disply the image from the folder by using the image name in the database, I fail each time. The folder where the images are being stored is named: saveimage Here is the query: <?php mysql_connect('localhost', 'root', '') or die ('Connection Failed'); mysql_select_db('imagedatabase'); $images = mysql_query("SELECT * FROM img WHERE email='$lemail'"); while($row = mysql_fetch_array($images)) { echo "<img src='saveimage/'".$row['img_description']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/ Share on other sites More sharing options...
wigwambam Posted May 20, 2012 Share Posted May 20, 2012 I think you may be missing your closing img tag: echo "<img src='saveimage/".$row['img_description']."' />"; [edited, moved single quote around image name] Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/#findComment-1346973 Share on other sites More sharing options...
angelali Posted May 20, 2012 Author Share Posted May 20, 2012 Oops sorry, I did include the closing tag, but forgot to write it above, but it is not working, see it below again: "<img src='saveimage/'".$row['img_description']."/>"; Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/#findComment-1346976 Share on other sites More sharing options...
wigwambam Posted May 20, 2012 Share Posted May 20, 2012 The single quote needs moving to the end: "<img src='saveimage/".$row['img_description']."' />"; Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/#findComment-1346984 Share on other sites More sharing options...
angelali Posted May 20, 2012 Author Share Posted May 20, 2012 Yes, now its working.. if I want to add alt text, width and height as well as title, can you do it for me? Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/#findComment-1346985 Share on other sites More sharing options...
wigwambam Posted May 20, 2012 Share Posted May 20, 2012 "<img src='saveimage/".$row['img_description']."' alt='alt text' width='100' height='100' />"; Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/#findComment-1346987 Share on other sites More sharing options...
angelali Posted May 20, 2012 Author Share Posted May 20, 2012 Its working fine, I want the user to delete the images if he wants, do you know how to delete image in the folder? I mean, each image, I will insert a link something like that or a checkbox, if the user click on it, it deletes the respective image he has clicked... it will have to delete the respective row of the image in database as well.. Quote Link to comment https://forums.phpfreaks.com/topic/262814-help-showing-images-fom-folder/#findComment-1346990 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.