Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

What is the best way to link an image with a record in mysql

This is a discussion on "What is the best way to link an image with a record in mysql" within the PHP Forum section. This forum, and the thread "What is the best way to link an image with a record in mysql are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 31st, 2006, 22:55
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
What is the best way to link an image with a record in mysql

Can someone please tell me how I can link an image to a specific record in my news table.

The news table currently has an id field (auto-increment), a title field, a timestamp field and a content field.

I use a form to insert the news item into the database and would like a specific image linked to each item of news.

I did try adding a column named image and a field on the form so I can put the name of the image to be stored in the database and I used this code to try and display the image but it doesn't work
PHP: Select all

echo "<b>".$code['title']."</b><br>Added on: ".$code['date']."<br>".nl2br($code['content'])."<img src=\"images/".$code['image'].".jpg\"><br><br>\n"
If there is a better way can someone please tell me how to do it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old Aug 1st, 2006, 00:09
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: What is the best way to link an image with a record in mysql

Your approach is perfectly sound.

Suggest something else wrong in the logic/coding somewhere. Check that the image is being stored where you think it is and that the name of the image in the database is what and where you think it is.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 1st, 2006, 13:10
Highly Reputable Member
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Re: What is the best way to link an image with a record in mysql

I checked the image name and location and it's in exactly where i put in the code.

Have you any more ideas/approaches I could use?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
best, link, image, record, mysql

« I need help | forms »
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Record the link you clicked to leave my page TheSealPortalTeam PHP Forum 22 May 5th, 2008 21:05
Variable record size in MySql? wmw Databases 2 Oct 6th, 2006 18:09
updating mysql record djme Databases 4 Jan 5th, 2006 00:09
Insert record in mysql djme Databases 1 Dec 24th, 2005 02:42
mysql update record djme Databases 4 Nov 28th, 2005 12:12


All times are GMT. The time now is 09:41.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8