Insert Text and Image to database and then Display

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ste9890
Forum Newbie
Posts: 1
Joined: Fri Mar 12, 2010 5:57 pm

Insert Text and Image to database and then Display

Post by ste9890 »

Before I start I'm a bit of a PHP/MYSQL newbie.

I have created a simple blog/news feed using PHP and MYSQL:
http://stephengreig.co.uk/newjack/blog.php

Currently I can insert the news post details into the database table and the news feed will update.

What I want to do is create a form where a user can input the post title and text as well as upload an image (which is the main bit I'm having trouble with). When submitted this form then inserts the data into the database and updates the news feed page.

My database table for the news post is simply: id, postdate, title, newstext.
Do I simply add another field for image with a BLOB type? Or does the image need its own table?

Any help would be greatly appreciated.
iamroming
Forum Commoner
Posts: 27
Joined: Sun Jan 31, 2010 4:02 am
Location: Hyderabad, India
Contact:

Re: Insert Text and Image to database and then Display

Post by iamroming »

stc hey buddy please be specific what u want to do? Do you want to update the inserted data or u want to add another post(news fields) by inserting?
and for the image u dont need to make a seperate table for that just add another feild .
and one more thing using BLOB makes the database heavy and slow i suggest u to make a field in which u insert the path and upload the image in your hosting server using FTP.
Post Reply