> mysql_field_name() might help... but generally I know what fields I want to > grab, so I don't need this... I found this answer on http://php.net/mysql. > just as you could :)
I've been coding in other languages for about 6 years now, and I have looked through a lot of the mysql stuff, and the explanations just don't make sense for me (or the examples, I can make them work, but don't understand why they work). it seems there are just basic's of the language they expect that you understand. piece by piece I'm getting it, but I'm not happy just copying code, and seeing something work. I've got to know why something worked, and feel like I understand more of the in's and out's. I think the howto's skip over a lot of things that have me confused. it seems like a lot of this stuff deals more with array's, and that's something I never learned to handle in other languages. this may be part of my problem... as far as using the select queries, that's an option most times, but there are some situations where there are too many calls to the database, and the code isn't efficient. here's a sample of things I made work, but don't understand... <TABLE border="3" cellspacing="2" cellpadding="2" bordercolor="#045C00" width="100%"> <TR align="center"> <TD align="left">Date</TD> <TD>ANI</TD> <TD>DNIS</TD> <TD>Country</TD> <TD>Destination</TD> <TD>Pay Phone</TD> <TD>Cost</TD> <TD align="right">Minutes</TD> </TR> no - obviously here I understand what fields I'm getting out of the database, but I'd prefer to use a syntax that would print the field names in the top column of the table, and make my code more transportable. with the stuff I'm doing this would be a great help. <? mysql_data_seek ($sql, 0); while ($row = mysql_fetch_assoc ($sql)) now - from what I understand from the php.net doc's page this is putting things in the array. does that mean that in order to parse a result set I have to turn it into an array, or can I directly access the recordset? (all examples point to creating an array out of it, not sure if this is necessity, or just a better way to parse a result set) now - my misunderstanding of this while statement throws me for a loop... I don't see anything in this code that moves a pointer to the next row, and yet it seems to? { echo "<TR>\n"; foreach ($row as $column) { echo "<TD>$column</TD>\n"; } echo "</TR>\n"; } echo "</TABLE>"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php