ok I have decided to delete the note ID from the table as this is not necessary as it just needs to display the notes to teh appointment_ID so I assume theere is something wrong with this query and echo commands. Using the following:
<?php
require '../include/config.php';
$sql = 'Select ap.Appointment_ID, ap.Date, ap.Time, ap.Pet_ID, p.Name, p.Species, p.Client_ID, cl.First_Name, cl.Last_Name, n.Notes ';
$sql.= 'From appointment as ap, pet as p, client as cl, notes as n ';
$sql.= 'Where ap.Pet_ID = p.Pet_ID AND p.Client_ID = cl.Client_ID AND ap.Appointment_ID = n.Appointment_ID AND cl.Client_ID=' . $_GET['Client_ID']. "' AND a.Appointment_ID = '" .$datNAMEsession."' "' ';
$sql.= 'ORDER BY ap.`Date`';
if (!$result = mysql_query($sql))
exit(mysql_error());
while
($row = mysql_fetch_assoc($result))
{
echo 'View a notes for Client ';
echo '<b>';
echo $row['First_Name'];
echo ' ';
echo $row['Last_Name'];
echo '</b>';
echo '<br><br>';
echo 'First Name ';
echo ' ';
echo '<b>';
echo $row['First_Name'];
echo '<br></b>';
echo 'Last Name ';
echo ' ';
echo '<b>';
echo $row['Last_Name'];
echo '<br></b>';
echo 'Pet Name / Species: ';
echo ' ';
echo '<b>';
echo $row['Name'];
echo ', ';
echo $row['Species'];
echo '<br>';
echo '</b>';
echo 'Apointment Date / Time: ';
echo ' ';
echo '<b>';
echo $row['Date'];
echo ', ';
echo $row['Time'];
echo ' <br><br>';
echo 'Note: ';
echo '<br></b>';
echo $row['Notes'];
echo ' <br>';
echo ' _______________________________________________________';
echo ' <br><br>';
}
?>
I call the notes that are attached to that appointment_ID and display them but if I add an additional note to the appointment it displays the information twice. i.e
View a notes for Client test test
First Name test
Last Name test
Pet Name / Species: test, test
Apointment Date / Time: , 09:00:00
Note:
this is a note
View a notes for Client test test
First Name test
Last Name test
Pet Name / Species: test, test
Apointment Date / Time: , 09:00:00
Note:
more notes
The notes should only be displayed like above if there are more than 1 appointment for that client. If an additional note is added to the client then I would need it to be displayed like below:
View a notes for Client test test
First Name test
Last Name test
Pet Name / Species: test, test
Apointment Date / Time: , 09:00:00
Note:
this is a note
more notes
I hope this helps clarify what I need to happen. Thank you for your time in looking at my problem.