diff --git a/app/contacts/contact_notes.php b/app/contacts/contact_notes.php index 67d8c16795..98476ad73a 100644 --- a/app/contacts/contact_notes.php +++ b/app/contacts/contact_notes.php @@ -46,23 +46,24 @@ echo "\n"; echo "\n"; - //get the contact list - $sql = "select * from v_contact_notes "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and contact_uuid = '$contact_uuid' "; - $sql .= "order by last_mod_date desc "; - $prep_statement = $db->prepare(check_sql($sql)); - if ($prep_statement) { - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - $result_count = count($result); - unset ($prep_statement, $sql); - } +//get the contact list + $sql = "select * from v_contact_notes "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '$contact_uuid' "; + $sql .= "order by last_mod_date desc "; + $prep_statement = $db->prepare(check_sql($sql)); + if ($prep_statement) { + $prep_statement->execute(); + $contact_notes = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset ($prep_statement, $sql); + } +//set the row style array $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; +//show the content echo "\n"; echo "\n"; @@ -78,9 +79,10 @@ echo "
"; echo "
\n"; - if ($result_count != 0) { - foreach($result as $row) { - $contact_note = escape($row['contact_note']); + if (is_array($contact_notes)) { + foreach($contact_notes as $row) { + $contact_note = $row['contact_note']; + $contact_note = escape($contact_note); $contact_note = str_replace("\n","
",$contact_note); if (permission_exists('contact_note_add')) { $tr_link = "href='contact_note_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_note_uuid'])."'"; @@ -88,7 +90,7 @@ echo "\n"; echo " \n"; echo " \n"; $c = ($c) ? 0 : 1; } //end foreach - unset($sql, $result, $row_count); + unset($sql, $contact_notes); } //end if results echo "
"; echo "
".escape($row['last_mod_user']).": ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."
"; - echo escape($contact_note)." "; + echo $contact_note." "; echo "
"; if (permission_exists('contact_note_edit')) { @@ -101,7 +103,7 @@ echo "
"; echo "\n";