Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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 October 15th, 2006, 04:09 PM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default function generate_rating from chapter 4

I've tried debugging and even simply retyping this code repeatedly but nothing seems to work. The rest of the page works but the thumbsup image just does not show up.

here's the code:

function generate_ratings($review_rating) {
    $movie_rating = '';
    for($i=0; $i<review_rating; $i++) {
        $movie_rating .= "<img src=\"thumbsup.gif\">";
    }
    return $movie_rating;
}

and this is where it's used:

while($review_row = mysql_fetch_array($review_result)) {
    $review_flag=1;
    $review_title[]=$review_row['review_name'];
    $reviewer_name[]=ucwords($review_row['review_reviewer_name']);
    $review[]=$review_row['review_comment'];
    $review_date[]=$review_row['review_date'];
    $review_rating[]=generate_ratings($review_row['review_rating']);
}


can anybody tell me what I'm missing? thanks!

 
Old October 31st, 2006, 06:01 PM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey Angelina,

Is the image actually there? maybe add an alt tag to your <img> tag so that will show up if the path to the image is broken.

Next thing is does the database have some numbers in the review_rating field - looks to me like the function only inserts the image tag if the review_rating field is >0.

You could as a debugging thing have your function return "!" . $movie_rating. If you can see the exclamation mark then its definitely getting called.

Let us know if thats any help.

cheers,

--
Don't Stand on your head - you'll get footprints in your hair
                                           http://charlieharvey.org.uk
                                              http://charlieharvey.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 7 imagefilter function error magicfun BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 February 24th, 2008 09:16 PM
Chapter 2 Pg. 75-77 while function joshkosmala BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 February 28th, 2007 04:27 PM
chapter 7 gd_info not a function? stickybomb BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 August 12th, 2006 07:38 PM
Chapter 7 - Function "Dete" ? ReptLady BOOK: Beginning VB.NET Databases 1 September 13th, 2005 12:42 PM
Chapter 6 Edit function isn't working Graham76 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 3rd, 2004 10:23 PM





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