Jump to content


This topic is now archived and is closed to further replies.


A basic problem that I can't get my head around --sorted---

Recommended Posts


$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);




<table border="1">
<td> mychoice </td>

  <?php do { ?>
      <td><?php echo $row_Recordset1['ID']; ?></td>
      <td><?php echo $row_Recordset1['artist']; ?></td>
<td>**  <?php echo $row_Recordset1 +1 ['artist']; ?>    **</td>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

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?

Share this post

Link to post
Share on other sites
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]


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.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.