Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 23rd, 2006, 06:39 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
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++;
}

Reply With Quote
  #2 (permalink)  
Old July 25th, 2006, 07:16 PM
Friend of Wrox
 
Join Date: Jan 2006
Location: San Francisco, CA, USA.
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/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:39 PM.


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