Hi
Could anyone make any suggestions to why this is only printing the first line of data in my database??
I have 3 colums and abouts 20 rows.

<?php
session_start();
if ($_SESSION['logged'] != true) {
header("Location: index.php");
exit;
} 
include "../db_con/connect.php"; 
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YRSA | Blog</title>
<?php
$count = 0;
$db_return = array();

$query = " SELECT * FROM yrsa_blog " ;
$result = MYSQL_QUERY($query);
$line = mysql_fetch_array($result, MYSQL_ASSOC);

foreach ($line as $col_value) {
           $db_return[$count] = $col_value;
		   $count++ ;
	    };
?>
<style>
body {
background:url(img/YRSA.jpg) no-repeat #081448 center top; 
margin-left:300px;
}
h3 {color:#FFFFFF; font-family:Arial;  margin-top:130px;}
</style>
</head>

<body>
<h3><u>Welcome <?php echo $_SESSION['name']; ?></u></h3>
<table>
<?php
$i=0;
while  ($line = mysql_fetch_array($result, MYSQL_ASSOC)); { 
$name = $db_return[$i];
$comment = $db_return[$i+1];
$date = $db_return[$i+2];


?>

<tr>
<td>Name: <?php echo $name ; ?></td>
<td>Comment: <?php echo $comment ; ?></td>
<td>date: <?php echo $date ?></td>
<tr>

<?php $i = $i + 4; };

 ?>
</table>
</body>
</html>

any help greatly appreciated
Thanks

sorry all

I realized just after that i forgot the while statement was needed around the foreach.

<?php
session_start();
if ($_SESSION['logged'] != true) {
header("Location: index.php");
exit;
} 
include "../db_con/connect.php"; 
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YRSA | Blog</title>
<style>
body {
background:url(img/YRSA.jpg) no-repeat #081448 center top; 
margin-left:300px;
}
h3 {color:#FFFFFF; font-family:Arial;  margin-top:130px;}
</style>
</head>

<body>
<h3><u>Welcome <?php echo $_SESSION['name']; ?></u></h3>
<?php
$count = 0;
$i=0;
$db_return = array();

$query = " SELECT * FROM yrsa_blog" ;
$result = MYSQL_QUERY($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
foreach ($line as $col_value) {
           $db_return[$count] = $col_value;
		   $count++ ;
	    };
echo "<table>";

$name = $db_return[$i];
$comment = $db_return[$i+1];
$date = $db_return[$i+2];

?>

<tr>
<td>Name: <?php echo $name ; ?></td>
<td>Comment: <?php echo $comment ; ?></td>
<td>date: <?php echo $date ?></td>
<tr>

<?php $i = $i + 3; };

 ?>
</table>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.