huntrguy102 Posted February 17, 2010 Share Posted February 17, 2010 I have books in a database and I have all the pictures that I want to use. Is there a way to have these pictures in a database to pull and put on a page using php? Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted February 17, 2010 Share Posted February 17, 2010 It will be better to store the image name(and path if needed) in the database and store the images in a directory. Quote Link to comment Share on other sites More sharing options...
huntrguy102 Posted February 17, 2010 Author Share Posted February 17, 2010 ok thanks. Quote Link to comment Share on other sites More sharing options...
huntrguy102 Posted February 17, 2010 Author Share Posted February 17, 2010 ok so I put them in a directory. But I'm still not sure on how to fetch the data from the database and post it. Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted February 17, 2010 Share Posted February 17, 2010 so each image is associated with a book so you need the path to the image in the database in a field with the book entry Then you for example: ///$site_url is the full path of your domain $sql = "SELECT url WHERE book_id = '$book_id'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); echo $site_url.'/images/'.$row['url']; something like that 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.