skipping line in php!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jkelly
Forum Newbie
Posts: 6
Joined: Tue May 31, 2005 10:12 am

skipping line in php!

Post by jkelly »

Hello!
This is the easiest question ye'll get all day. How do you skip a line in php...basically i have a while loop and i want it to skip after each record is read in.

Code: Select all

<?php while($row_cpu = mysql_fetch_array($cpu))
{
	echo $row_cpu['Speed1'];
} ?>
As you see, its simple stuff, but I'm new!
Thanks for your help
Ross2376
Forum Newbie
Posts: 19
Joined: Mon May 30, 2005 12:03 am

Post by Ross2376 »

Use PHP tags for PHP.

Code: Select all

<?php 
while($row_cpu = mysql_fetch_array($cpu))  {
   echo $row_cpu['Speed1'];
} 
?>
Add the <br /> to make a new line like this:

Code: Select all

<?php 
while($row_cpu = mysql_fetch_array($cpu))  {
   echo ($row_cpu['Speed1'] . "<br />");
} 
?>
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Readings lines makes me think about a file... You are nowhere reading a file ;)


If you mean, output a newline after each record/row

Code: Select all

while ($row = myqsl_fetch_*(...))
{
    echo $row['whatever'];
    echo "<br/>";
}
jkelly
Forum Newbie
Posts: 6
Joined: Tue May 31, 2005 10:12 am

Post by jkelly »

thanks for that fellas!
Post Reply