how can i post and display the photograph using php and mysq

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

how can i post and display the photograph using php and mysq

Post by softsolvers »

dear friends
i like to display a photograph in the my web page wich can be stored in the database can u suggest me how can i do this
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

Code: Select all

$dBHost 	= "*****";
	$dbUser 	= "*****";
	$dbPass 	= "*****";
	$dbDatabase 	= "*****";
	$db_connection = mysql_connect($dbHost, $dbUser, $dbPass) or die("Could not connect to DB");
	mysql_select_db($dbDatabase, $db_connection) or die ("Could not find DB");
	$result = mysql_query("SELECT img_location FROM database WHERE id='$id'");
	$row = mysql_fetch_object($result);
	print "<img src="".$row->img_location."">";
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

Thanks but i want to upload the file in one page and then display the image when needed.So if u please suggest me the process and the way i shoul proceed.
Thanks
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

ok

heres the process
1. upload
2. get filename
3. insert filename into db
4 when you want to display the image just use the db to get the filename
5.
6.profit
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

Hey Man,
i know such processes , my problem is concerned to get that very coding which is needed to get this. is there any specific function used to upload the file. just get me aware with only these things and please don't beat in the bush

softsolvers
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

softsolvers wrote:Hey Man,
i know such processes , my problem is concerned to get that very coding which is needed to get this. is there any specific function used to upload the file. just get me aware with only these things and please don't beat in the bush

softsolvers
You are aware that this is not a script-writing service - if you want someone to write code for you please post in the Project Help Wanted/Volunteer Work Forum - the PHP - Code forum is for helping people who have at least attempted to do the work themselves.

Mac
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

i need to solve this prob as soon as possible, so plz. send me thesanpshot of the code that how could i first store the image in the database and then how i could access the image on the page,plz do help me?????
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Make an attempt yourself to answer your question, search the web and this forum, you are asking something that others have already found the answer to, stop being lazy. You must make some attempt - we are not here to do your work for you.

Mac
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Well said. I don't mean to stir the pot, but it looks like you are new, so I guess this is a warning.

Here's a more direct link that may help you in your quest.

http://us4.php.net/features.file-upload
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

moved to help wanted
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

hello friends
Had you forgot ,i still facing problem i had searched on net but i am not getting the proper site from where i can get the solution will u plz. help me plz send me the place from where i got help or send me the snap of the code.
Looikng for post
Softsolvers
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

how to post and display the photograph using php and mysq

Post by softsolvers »

hello friends
Had you forgot ,i still facing problem i had searched on net but i am not getting the proper site from where i can get the solution will u plz. help me plz send me the place from where i got help or send me the snap of the code.
Looikng for post
Softsolvers
_________________
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Code: Select all

<form enctype="multipart/form-data" action="_URL_" method="post">
 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
 Send this file: <input name="userfile" type="file" />
 <input type="submit" value="Send File" />
</form>
Look 4 posts up, then the second post in this thread....
User avatar
softsolvers
Forum Commoner
Posts: 75
Joined: Fri Feb 13, 2004 4:26 am
Location: India

Post by softsolvers »

Thanks,but i am telling you my actual requirement.i am making a site,in which i need to display image,for this on one page i like to give a button browse to choose the path of image and then store the image from that path to database,and on the next page i want to see that image,which fields i should take in mysql table,i am a new for php so plz. help me
Post Reply