Date: 06/29/02
- Next message: CrossWalkCentral: "[PHP-DB] mail function"
- Previous message: Steve Edberg: "[PHP-DB] Re: [PHP] Usiing FOREACH to loop through Array"
- Next in thread: Brad Melendy: "[PHP-DB] Re: [PHP] Usiing FOREACH to loop through Array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 sbedberg <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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: CrossWalkCentral: "[PHP-DB] mail function"
- Previous message: Steve Edberg: "[PHP-DB] Re: [PHP] Usiing FOREACH to loop through Array"
- Next in thread: Brad Melendy: "[PHP-DB] Re: [PHP] Usiing FOREACH to loop through Array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

