Hi Jess,

If there will never be another ID number, something like the following
should work (although I don't know about the "<BR>\n" part):

<SNIPPET>

$Row = mysql_fetch_array ($Result);
print ("ID: $Row[id]<BR>\n");
print ("$Row[technotes]<BR>\n");

while ($Row = mysql_fetch_array ($Result))
{
        print ("$Row[technotes]<BR>\n");
}

</SNIPPET>

But, if there is the possibility that there could be more than one ID
number, you would want to compare the ID with the previous ID. If they are
different, you would need to print the new ID and then its technotes. Try
this:

<SNIPPET>

$Row = mysql_fetch_array ($Result);
$tempid = $Row[id];

print ("ID: $Row[id]<BR>\n");
print ("$Row[technotes]<BR>\n");

while ($Row = mysql_fetch_array ($Result))
{
        if ($Row[id] == $tempid)
        {
                print ("$Row[technotes]<BR>\n");
        }
        else
        {
                print ("<BR>\n");
                print ("ID: $Row[id]<BR>\n");
                print ("$Row[technotes]<BR>\n");
                $tempid = $Row[id];
        }
}

</SNIPPET>

Bob


-----Original Message-----
From: Hunter, Jess [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 14, 2003 11:02 AM
To: [EMAIL PROTECTED]
Subject: Another Brickwall with Displaying using JOIN


OK, Have another small issue that maybe someone could help me out with.

When using a JOIN I can pull records from a second table without a problem
(now).

I am wanting to display two fields ( id and notes) however I only want the
id field to display once and all the notes to be displayed.

Here is the syntax I am trying to use:

<SNIPPET>

$Query="SELECT * from $TableName2 LEFT JOIN $TableName1 ON ($TableName2.id =
$TableName1.id) WHERE $TableName2.initials='jlh'";
$Result= mysql_db_query ($DBName, $Query, $Link);

while ($Row = mysql_fetch_array ($Result)){
print ("ID: $Row[id] - $Row[technotes]<BR>\n");
}
</SNIPPET>
Which produces this display

ID: 1 - This is the first record
ID: 1 - This is the second record
ID: 1 - This is the third record

In the end I want to have it displayed as such:

ID: 1
This is the first record
This is the second record
This is the third record

Any and all help would be appreciated

Jess

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.550 / Virus Database: 342 - Release Date: 12/9/03


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to