Techbot Posted August 27, 2006 Share Posted August 27, 2006 [code]$query_Recordset1 = "SELECT ID, artist FROM songlist";$Recordset1 = mysql_query($query_Recordset1, $bot) or die(mysql_error());$row_Recordset1 = mysql_fetch_assoc($Recordset1);$totalRows_Recordset1 = mysql_num_rows($Recordset1);?><head></head><body><table border="1"> <tr> <td>ID</td> <td>artist</td> <td> mychoice </td> </tr> <?php do { ?> <tr> <td><?php echo $row_Recordset1['ID']; ?></td> <td><?php echo $row_Recordset1['artist']; ?></td> <td>** <?php echo $row_Recordset1 +1 ['artist']; ?> **</td> </tr> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></table></body></html><?phpmysql_free_result($Recordset1);?>[/code]This looks to me like the indices are column indices while row indices are internal. Is this the case? Needless to say the +1 (maked **) doesn't work.Is this correct? I always thought that an index was primaraily a record index. Yet according to my logic here, it's a field index. ie $row_Recordset1 selects the row (or record) and 'ID' and 'artist' are indices that select the required field.Does my question make any sense? Link to comment https://forums.phpfreaks.com/topic/18808-a-basic-problem-that-i-cant-get-my-head-around-sorted/ Share on other sites More sharing options...
Techbot Posted August 27, 2006 Author Share Posted August 27, 2006 Is it the case that $row_Recordset1 is the complete array ie I only have access to one record at a time.Where do I start looking if I want $row_recordsetset1 to be a subset of the entire table so I can access the artist field of the 6th or 7th record ie $row_recordset1[6]['artist] ----EDIT----Ok I was treating the whole table as one big array rather than each row. Doh!Of course it makes sense (memory and time wise). Just makes my coding a lot more difficult. Ah well. Link to comment https://forums.phpfreaks.com/topic/18808-a-basic-problem-that-i-cant-get-my-head-around-sorted/#findComment-81138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.