I'm trying to inform myself about exactly what Dreamweaver's PHP/MySQL code is doing when creating a recordset and repeat region. Please help if you can.
DW MX generates the following to create a simple recordset... Line 1) require_once('Connections/TBA.php'); Line 2) mysql_select_db($database_TBA, $TBA); Line 3) $query_RS_CourseEnrollment = "SELECT * FROM tba_courseenrollment"; Line 4) $RS_CourseEnrollment = mysql_query($query_RS_CourseEnrollment, $TBA) or die(mysql_error()); Line 5) $row_RS_CourseEnrollment = mysql_fetch_assoc($RS_CourseEnrollment); Line 6) $totalRows_RS_CourseEnrollment = mysql_num_rows($RS_CourseEnrollment); I understand (or think I understand) the following... Line 1 grabs the information from an external file to connect to the database. Line 2 creates the connection to the database using the data obtained in line 1. Line 3 creates the actual query and saves it to a variable. Line 4 executes the query and saves the result to a variable (I think). Line 5 grabs the currently "pointed to" record (usually the first) and assigns its contents to a PHP Array. Line 6 stores the number of records in the recordset to a variable. In a repeat region DM MX writes... Line 1) <?php do { ?> Lines 2 - ?) put something on the page Line Last) <?php } while ($row_RS_CourseEnrollment = mysql_fetch_assoc($RS_CourseEnrollment)); ?> I understand (or think I understand) the following... Line 1 starts the loop. Lines 2 through ? draws stuff on the page. Line Last restarts the loop by grabbing the next record in the recordset. Here are my questions... 1) Do I understand what's going on? 2) When I ECHO the variable created in Line 4 of the connection I get "Resource id #4". Why don't I get "Array" or something I can read? 3) Because the last line of the repeat region includes "mysql_fetch_assoc($variableDefiningTheQuery)" does this mean that the database is queried every time through the loop? 4) I can't find "mysql_fetch_assoc()" in the MySQL documentation. What's this command do? I know this is a long post and a lot of quesitons. Just trying to understand what's going on. And, maybe your answers will help others on the board. Thanx, -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams ---------------------------------------------------- http://www.digitaliguana.com http://www.cancerreallysucks.org -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]