Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning 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 July 23rd, 2006, 06:39 AM
Registered User
 
Join Date: Jun 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default HOW DECLARE VARIABLES IN PHP

HERE IS THE CODE:

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']);
}
$i=0;
while($i<sizeof($review))
{
$review_details .=<<<EOD
 <tr>
    <td width='15%' valign='top' align='center'>$review_date[$i]</td>
    <td width='15%' valign='top'>$review_title[$i]</td>
    <td width='10%' valign='top'>$reviewer_name[$i]</td>
    <td width='50%' valign='top'>$review[$i]</td>
    <td width='10%' valign='top'align='center'>$review_rating[$i]</td>
 </tr>
EOD;
 $i++;
}

 
Old July 25th, 2006, 07:16 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your code looks fine on initial glance. What error are you getting? Also, I'd recommend using a for loop instead of a while loop here, since a for loop is designed for exactly what you're doing.

Jon Emerson
http://www.jonemerson.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to declare variables rehana Beginning PHP 11 April 30th, 2013 04:59 AM
changing the value of variables in PHP jflores1 PHP How-To 1 January 8th, 2006 12:09 AM
Passing Variables from PHP to PHP brian3166 PHP How-To 4 January 31st, 2005 12:44 AM
Can I declare variables visable from every script Makis Beginning PHP 1 January 11th, 2004 02:02 AM
how to declare date variables rehana Beginning PHP 1 December 15th, 2003 05:56 PM





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