Oops! It's hot, it's Saturday, brain not functioning at 100%, made cut'n'paste error:
<SNIP> or (2) set a flag in getCourses() so that the query is only executed once, otherwise returning a result line - something like: function getCourses($UID) global $link; static $result = false; if (!$result) { $result = mysql_query( "SELECT C.CourseName FROM tblcourses C, tblusers U, tblEnrollment E WHERE C.ID = E.CourseID AND E.UserID = U.ID AND U.ID = $UID", $link ); if ( ! $result ) die ( "getRow fatal error: ".mysql_error() ); } { return mysql_fetch_array( $result ); } ... while ($Row = getCourses($session[id]) as $value) { print "<br>", $Row['C.CourseName']; } <SNIP> This last block of code should be while ($Row = getCourses($session[id])) { print "<br>", $Row['C.CourseName']; } -steve -- +------------------------------------------------------------------------+ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +------------------------------------------------------------------------+ | The end to politics as usual: | | The Monster Raving Loony Party (http://www.omrlp.com/) | +------------------------------------------------------------------------+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php