logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-25-2007, 07:44 PM   #1
m1a2x3x7
m1a2x3x7's Avatar
 
Join Date: Mar 2007
Posts: 297
Thumbs up Question for davidj and his echoing results php vid

Hey David,

I'm new here and I first would like to say thanks. This is great stuff and I'm learning a lot. I've read two books but have gotten the best understanding from you vids.

I do have 1 question. When we enter the do while loop I understand the reason for it and how it works, but I don't understand the syntax for it.

PHP Code:
 <?php do { ?>
  <tr>
    <td><?php echo $row['field1_id'];?></td>
    <td><?php echo $row['field2'];?></td>
    <td><?php echo $row['field3'];?></td>
    <td><?php echo $row['field4'];?></td>
  </tr>
  <?php }while ($row mysql_fetch_array($result)); ?>
</table>
Why is it that when you start the do while loop you open the php and then just place the do{ then close it? I know that if you don't do that it wont run I've tested it many times different ways. I'm just curious to why you need to close it before the loop is finished.

Thanks...again great stuff
m1a2x3x7 is offline   Reply With Quote
Old 03-26-2007, 01:45 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

you are not closing the loop just the PHP

You are allowing the php to render pure HTML after the curly brace. If you didnt do that you would have to echo all the html line by line if you didnt escape the PHP

does this make it clearer?
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 03-26-2007, 03:50 PM   #3
m1a2x3x7
m1a2x3x7's Avatar
 
Join Date: Mar 2007
Posts: 297
Default

yes it does...thank you
m1a2x3x7 is offline   Reply With Quote
Reply


Thread Tools
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 On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com