Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2004, 04:53 AM
Authorized User
 
Join Date: Sep 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to major dynamic123
Default

Hi. Thanks for the advice. I need a little help here. I've stored the location of a book cover(in jpg format) in another directory. How do I retrieve the location stored in the database and display the book cover to users screen?

Thanks.

Regards,
Major


// below is the source code

      <?php
         include("./ehexagon/usr.inc");
         $bookdetail = $HTTP_GET_VARS['id'];

         $query = "select bk.isbn, bk.title, bk.author, bk.price, bk.pages, bk.misc, bk.edition, bk.fk_pubID,
                          t.title, t.synopsis, t.fk_maincatID, t.fk_subcatID,
                          i.fk_mediaID, i.url,
                          md.mediaID, md.media,
                          cv.coverID, cv.cover,
                          y.yrID, y.yr,
                          m.mthID, m.mth
                      from book_tbl bk,
                           title_tbl t,
                           isbn_tbl i,
                           media_tbl md,
                           cover_tbl cv,
                           yr_tbl y, mth_tbl m
                      where bk.title ='$bookdetail' and
                            bk.isbn = i.isbn and
                            i.fk_mediaID = md.mediaID and
                            i.fk_coverID = cv.coverID and
                            i.fk_yrID = y.yrID and
                            i.fk_mthID = m.mthID";

         $result = mysql_query($query) or die("Error in query");

         while($row=mysql_fetch_object($result)) {
            $row->title .'<br>';


            // I have problems here. How do I display the
            // book jacket using echo statement?
            echo '<img src="'.$row->url.'>"';



            echo 'ISBN: '.$row->isbn .'<br>';
            echo 'Author: '.$row->author .'<br>';
            echo 'Media: '.$row->media .', '.$row->cover.', '.$row->pages.' pages.<br>';
            echo 'Date published: '.$row->mth.', '.$row->yr.'<br>';
            echo 'Price: '.$row->price.'<br>';
            echo 'Pages: '.$row->pages .'<br>';
            echo 'About the book:'.$row->synopsis .'<br>';
         <? }

         mysql_close($connection);
      ?>

 
Old March 19th, 2004, 06:13 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You messed up your " and ' s...

Not this: echo '<img src="'.$row->url.'>"';

This: echo '<img src="' . $row->url . '">';

Try it and it should work if $row->url is valid.

HTH,

----------
---Snib---
----------

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with paginating and anchor link. major dynamic123 Pro PHP 6 September 11th, 2003 01:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.