RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 47160 | Replies: 16
Reply
Join Date: Jan 2006
Posts: 29
Reputation: rcasinillo_s is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rcasinillo_s rcasinillo_s is offline Offline
Light Poster

How insert image into mysql database and retrieve

  #1  
Feb 20th, 2006
Good day everyone! Anybody could give me script for uploading or inserting image into database and how to retrieve it and print it to browser

Any help would be appreciated.

Thank you in advance.

roland
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2005
Posts: 354
Reputation: DanceInstructor is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 12
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: How insert image into mysql database and retrieve

  #2  
Feb 20th, 2006
Are you sure you really want to do that? I think that for most applications you will be better off storing the image in a folder on your webserver and adding the location/details of the image to the database.
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote  
Join Date: Jan 2006
Posts: 29
Reputation: rcasinillo_s is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
rcasinillo_s rcasinillo_s is offline Offline
Light Poster

Re: How insert image into mysql database and retrieve

  #3  
Feb 20th, 2006
Originally Posted by DanceInstructor
Are you sure you really want to do that? I think that for most applications you will be better off storing the image in a folder on your webserver and adding the location/details of the image to the database.

Okey, thinks for your advice, but how can I do that, are there any configuration to be done in the server, could you give me a script for this?

Thank you.

Roland
Reply With Quote  
Join Date: Feb 2005
Posts: 354
Reputation: DanceInstructor is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 12
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: How insert image into mysql database and retrieve

  #4  
Feb 20th, 2006
I haven't tried this myself, but there is a brief tutorial here:

http://hockinson.com/index.php?s=37

Good luck.
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote  
Join Date: Apr 2004
Location: Virginia Beach
Posts: 113
Reputation: liliafan is on a distinguished road 
Rep Power: 5
Solved Threads: 2
liliafan's Avatar
liliafan liliafan is offline Offline
Junior Poster

Re: How insert image into mysql database and retrieve

  #5  
Apr 9th, 2006
If you do decide you want to store the image in a database (there are circumstances) then use a blob datatype.
Reply With Quote  
Join Date: Mar 2006
Location: Florence Ky
Posts: 31
Reputation: DGStudios is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
DGStudios DGStudios is offline Offline
Light Poster

Re: How insert image into mysql database and retrieve

  #6  
Apr 15th, 2006
I will agree that it is rare that you would want to do that outside of a data hosting site like that. Otherwise you can just store the url and output it however you want by calling it with php and tellting using the following code

echo '<img src ="'.$imgurl.'">';

That will output it as the image itself. Naturally you can add the formating to it. But I find that method INCREADIBY effective.
http://img.photobucket.com/albums/v6.../dgstudios.jpg
When all that is becomes one. That is the anomoly. That is... Death's Gate Studios (c) 2005
Reply With Quote  
Join Date: Mar 2006
Posts: 84
Reputation: web_developer is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
web_developer web_developer is offline Offline
Junior Poster in Training

Re: How insert image into mysql database and retrieve

  #7  
Apr 15th, 2006
hey guys
i have problem somehow similtar to this, how to insert colored, formated text in db and retrieve it.
when i play with the font or anything of the text throught html editor, the text is not saved in db.

the text attribute is empty, what should i write as a script.

thanks

sam
Reply With Quote  
Join Date: Mar 2006
Location: Florence Ky
Posts: 31
Reputation: DGStudios is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
DGStudios DGStudios is offline Offline
Light Poster

Re: How insert image into mysql database and retrieve

  #8  
Apr 15th, 2006
I store things in it using full text

I store it using a variable like so

$value = '<b><center><fontcolor= "blue">This is the formated text</b></center></font>';
$query = "instert into table ('$value')";
mysql_query($query);


I use formated text alot for my forum.

Also it is possible to simply output it the text using concatenated strings with php. Its up to what you're using the text for.
http://img.photobucket.com/albums/v6.../dgstudios.jpg
When all that is becomes one. That is the anomoly. That is... Death's Gate Studios (c) 2005
Reply With Quote  
Join Date: Oct 2006
Location: Sofia, Bulgaria
Posts: 225
Reputation: Rhyan is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 22
Rhyan's Avatar
Rhyan Rhyan is offline Offline
Posting Whiz in Training

Re: How insert image into mysql database and retrieve

  #9  
Oct 19th, 2006
Originally Posted by DGStudios View Post
I store things in it using full text

I store it using a variable like so

$value = '<b><center><fontcolor= "blue">This is the formated text</b></center></font>';
$query = "instert into table ('$value')";
mysql_query($query);


I use formated text alot for my forum.

Also it is possible to simply output it the text using concatenated strings with php. Its up to what you're using the text for.


This is one way, however you will be unable to use this value in another place with another color settings. Instead I would recommend you store plain text data into your database and use some simple CSS rules where you need the text to be in different color.
You can make the following:
1. Store value $formatted_text = This is the text to be returned in red.
2. Retrieve it in your php page like this: [php]echo '<p style="color: red">'.$formatted_text.'</p>'; [/php]and you will get it right

if you want you can use a class for this statement and add a lot of other formatting stored in an external file.

In case however you have some text and you want to store only one word with formatting, you better do the following:

[php] $formatted_text = 'This is the text with <span style="color: red;">red words</span> in the middle.';[/php]

When you retrieve it in your php like this:

[php]echo '<p>'.$formatted_text.'</p>';[/php]

you will have a paragraph with "red words" being the only red words inside the text.

If you are not familiar with CSS go to http://www.w3schools.com/ and learn it for free from the W3C. Good luck!
Last edited by Rhyan : Oct 19th, 2006 at 10:10 am. Reason: A bit of additional info added
Reply With Quote  
Join Date: Oct 2006
Posts: 10
Reputation: remiremi is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 1
remiremi remiremi is offline Offline
Newbie Poster

Re: How insert image into mysql database and retrieve

  #10  
Oct 28th, 2006
All u do is, use ASP. The database that I've chosen is Microsoft Access database. I could have explained it on Microsoft SQL server but I chose Access because it is inexpensive and widely available. Transition form Access to SQL Server is painless.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:13 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC