retrieve an image in php
Page 1 of 112 Replies - 2166 Views - Last Post: 21 April 2011 - 05:15 AM
#1
retrieve an image in php
Posted 13 March 2011 - 07:05 AM
how to retrieve a image from mysql database?using PHP..
Replies To: retrieve an image in php
#2
Re: retrieve an image in php
Posted 13 March 2011 - 07:09 AM
Well, that would all depend on how you're SAVING the image in your database.
#3
Re: retrieve an image in php
Posted 13 March 2011 - 07:23 AM
tharu901, on 13 March 2011 - 07:05 AM, said:
how to retrieve a image from mysql database?using PHP..
<?php
$con=mysql_connect("localhost", "root", "");
mysql_select_db("mobile_hut",$con);
$query = "SELECT * FROM news";
$result = mysql_query($query);
while ($r=mysql_fetch_array($result))
{
$pic = $r['image'];
echo '<img src="$pic">' ;
}
mysql_close($con);
?>
that is code i use it for image retrieval but it does not show ihe image..
#4
Re: retrieve an image in php
Posted 13 March 2011 - 07:28 AM
Again, I asked how you SAVED it in the DB, not how you're retrieving it!
#5
Re: retrieve an image in php
Posted 13 March 2011 - 08:23 AM
#6
Re: retrieve an image in php
Posted 13 March 2011 - 08:55 AM
Are you storing the actual image as TEXT or are you saving the PATH to the image?
There are eleven billion tutorials on this available to you through Google. I would suggest you find one and use it.
There are eleven billion tutorials on this available to you through Google. I would suggest you find one and use it.
#7
Re: retrieve an image in php
Posted 13 March 2011 - 09:30 AM
JackOfAllTrades, on 13 March 2011 - 08:55 AM, said:
Are you storing the actual image as TEXT or are you saving the PATH to the image?
There are eleven billion tutorials on this available to you through Google. I would suggest you find one and use it.
There are eleven billion tutorials on this available to you through Google. I would suggest you find one and use it.
yes i stored the path of image as text....
ya definitely there are billions of tutorials i follow the few of these but i cant satisfy with it...please can you help me even give a simple tutorials as a link.....
#8
Re: retrieve an image in php
Posted 13 March 2011 - 03:16 PM
Are you storing the full path? Just the file name? What about extension?
What I mean is:
Suppose your image is called dream_in_code_rulez.jpg and is stored in /images/.
Are you storing:
If you are only storing the file name, with out an extension, you would need to modify your code like so:
Also please note that I have closed the image tag correctly.
Also are you getting any errors?
What I mean is:
Suppose your image is called dream_in_code_rulez.jpg and is stored in /images/.
Are you storing:
- dream_in_code_rulez
- dream_in_code_rulez.jpg
- images/dream_in_code_rulez.jpg
If you are only storing the file name, with out an extension, you would need to modify your code like so:
echo "<img src=images/'$pic'.jpg />";
Also are you getting any errors?
This post has been edited by KingCuddles: 13 March 2011 - 03:49 PM
#9
Re: retrieve an image in php
Posted 13 March 2011 - 03:41 PM
#10
Re: retrieve an image in php
Posted 13 March 2011 - 03:49 PM
maybe you got wrong with saving the image..which is the most important because how will u able to retrieve if it is not there or the file doesn't exist. please check if you include the directory name,file name, and also the extension,. u can get all of this at your upload script. be guided..
#12
Re: retrieve an image in php
Posted 20 April 2011 - 10:26 PM
Well Thanks for all the suggestion. I have saved the image in a table named "children" in a mysql database. It is saved as a link (url) example
http://www.............ages/Childrens/sn3.jpg
What I want to know is how to retrieve this link either to a variabale or as the link itself and show the image in a web page. What I am trying to do is to show the images like in a slide show. I am working with PHP.
Hope you can help me.
Thanks
Wilfred.
http://www.............ages/Childrens/sn3.jpg
What I want to know is how to retrieve this link either to a variabale or as the link itself and show the image in a web page. What I am trying to do is to show the images like in a slide show. I am working with PHP.
Hope you can help me.
Thanks
Wilfred.
This post has been edited by neil_12s: 20 April 2011 - 10:28 PM
#13
Re: retrieve an image in php
Posted 21 April 2011 - 05:15 AM
neil_12s, you received an answer in your own topic. Please don't resurrect older topics with a "me too" post!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|