Re: printing a one-to-many relationship

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



give this a shot

<html>
<head><title>items and notes</title></head>
<body>
<?php
$user="feeds";
$host="localhost";
$password="password";
$database = "feeds";

$connection = mysql_connect($host,$user,$password) or die ("couldn't connect to server");
$db = mysql_select_db($database,$connection) or die ("Couldn't select database");

$query = "SELECT * FROM contacts, px_items WHERE contacts.id=px_items.id ORDER BY px_items.id DESC";

$result = mysql_query($query) or die ("Couldn't execute query.");

$title = '';
while ($row = mysql_fetch_array($result)) {
	if ( $title != $row['title'] ) {
		$title = $row['title'];
		echo "<h2>{$title}</h2>";
	}
	echo	"&nbsp;&nbsp;{$id} - {$content} - {$timestamp} - {$notes} - ".
		"<a href=\"{$link}\">{$link}</a><br>";
}//while
?>
</body>
</html>


This should do the trick

--
Enjoy,

Jim Lucas

Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree.

- Rush

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux