Konnor Posted August 8, 2006 Share Posted August 8, 2006 I'm super new to blogging/php/mySQL and in the process of coding my own (following a tutorial from the book 'blog design solutions'). Unfortunately it doesnt show you how to add images to a blog post. Presumably you cannot directly store the image in the database, only a link to it. Ideally I would like a setup where I may or may not have an image for each blog post. What would I put as the field in the table? How could I code it so I sometime have images in my blog post and sometimes don't? My table currently looks like this..[img]http://img325.imageshack.us/img325/4480/blogtablepe9.jpg[/img]And my addpost screen looks like this [img]http://img325.imageshack.us/img325/2518/addposttl1.jpg[/img] Quote Link to comment Share on other sites More sharing options...
nethnet Posted August 8, 2006 Share Posted August 8, 2006 Actually, you can store images in a MySQL database if you create the field as a BLOB type. Quote Link to comment Share on other sites More sharing options...
corbin Posted August 8, 2006 Share Posted August 8, 2006 add a column to your table that is something like pic_url thenYou could add a picture url box on your form so they could put one if they wanted...Then when the form is processed have it put the url in the database if its a valid url...then when displaying it if the url column doesnt equal "" you could display it in an image tag Quote Link to comment 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.