You have a pretty good handle on what's happening there, I hope I can
add some clarity.
The Resource Id you're trying to echo is a pointer to a MySQL result
set, you aren't actually working with the data yet. That's where the
mysql_fetch functions come in.
The mysql_fetch_assoc function fetches the next line of the result set
and stores it in an associative array, so that you can reference your
results by their database field name, i.e.
$row_RS_CourseEnrollment['Id_field']. Otherwise, using a similar
function like mysql_fetch_row, you'd end up with
$row_RS_CourseEnrollment[0] for the first field, [1] for the second,
and so on. If you ever change your database and you're using select
*, this can get messy.
Additionally, the mysql_fetch functions are simply returning a portion
of the result of your previously executed query, so the database isn't
re-queried every time you loop through it.
Hope this helps!
On Fri, 10 Sep 2004 16:12:06 -0500, Robb Kerr
<rkerr.news@stripped> wrote:
> 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?
>