garlicka Posted June 14, 2006 Share Posted June 14, 2006 Hello, I am very very new to all this and am building a website.I have managed to Create a mySql Database, I have managed to upload information into the database and upload a file to the image directory.for exampleTable name is employeesUser inputs --Name goes to Name FieldEmail goes to Email FieldPhone goes to Phone FieldPhoto filename goes to Photo Field and the Image goes to my Upload Dir.When I do a search I can enter the name and it displays all info in the Database, but I cant seem to put a code in to view the picture too.Can anyone help my stupidity.Thanks Quote Link to comment https://forums.phpfreaks.com/topic/11991-viewing-images/ Share on other sites More sharing options...
.josh Posted June 14, 2006 Share Posted June 14, 2006 well in your script after it retrieves the info you just make an img tag.let's say your script looks something like this:[code]$name = $_POST['name'];$sql = "select * from employees where Name='$name'";$result = mysql_query($sql);$info = mysql_fetch_array($result);echo "Name: " . $info['Name'] . "<br>";echo "Email: " . $info['Email'] . "<br>";echo "<img src = '" . $info['Photo'] ."' />";[/code]this assumes that your photo holds the full name of the photo, like blah.jpg not just blah. and it also assumes that your photo is in the same directory as your script. if these things are not so, then you will have to alter your script to add on the extension and/or path to the img. Quote Link to comment https://forums.phpfreaks.com/topic/11991-viewing-images/#findComment-45605 Share on other sites More sharing options...
garlicka Posted June 14, 2006 Author Share Posted June 14, 2006 Thanks for that, I have it working now.But I do have a quick question , Do you know how to downsize the images or just show it in a Certain Area, When I open it up it uses the entire screen.Many Thanks Quote Link to comment https://forums.phpfreaks.com/topic/11991-viewing-images/#findComment-45644 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.