Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re : How to I get to a next entry
At 22:28 19/05/2005 +0000, you wrote:
>Message-Id: <200505191619.j4JGJj0Q064554@web2.nidhog.com>
>From: "John R. Sims, Jr." <jsims@frcpgh.org>
>To: <php-db@lists.php.net>, <php_mysql@yahoogroups.com>
>Date: Thu, 19 May 2005 12:20:24 -0400
>MIME-Version: 1.0
>Content-Type: multipart/alternative;
>         boundary="----=_NextPart_000_0015_01C55C6D.22CC6B60"
>Subject: More problems with a script.  How to I get to a next entry
>
>It allows the case manager to select the client and then it shows them the
>case note.  Only problem is that it only shows them one case note, and most
>of the clients will have several case notes that have been entered over the
>period of the program.

Yeah, you just need to loop your fetch_array request and build the HTML for
the notes from that, so :
 

Becomes


if ($result && mysql_num_rows($result)>0) {

$result = mysql_query($result);
$rownumber=0;
$note_fields='';
$resultset=array();

while ($row = mysql_fetch_array($result)) {
if ($rownumber==0) {
//      Copy the first result, it contains the summary data
$resultset=$row;
}       //      End if
//      And for all rows, concat the notes field as a list item :
$note_fields .= "<li>" . $row['note'] . "</li>\r\n\t";
//      Now we increment the row number to keep track
$rownumber++;
}       //      End while

}       //      End if

<!-- HTML modified to use lists for this sort of information -->

<tr>
<td>Subject:            </td>
<td><?=$resultset['subject']?></td>
</tr>
. . . . other HTML rows here using $resultset . . .
<tr>
<td>Notes:              </td>
<td>
<ol>
<?=$note_fields?>
</ol>
</td>
</tr>

Then just use CSS to style the <ol> list items however you like -
bulletted, indented, surrounded by a nice border with a background & margin
/ padding and so on.

Although that's not the most efficient way to do it, because you're looping
the entire recordset just to grab the note from each record - the other
attributes of the client record are also sent from the SQL server to the
PHP client. If you do that over a network then you've added a few % to the
needed bandwidth. Say, if you had 10000 notes per client, it might be
something to worry about - though with 10000 notes per client you'd also
have *other* things to worry about ;-)

Cheers - Neil



Report this thread to moderator Post Follow-up to this message
Old Post
Neil Smith [MVP, Digital media]
05-27-05 01:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.