Jump to content

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


Techbot

Recommended Posts

[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>
<?php
mysql_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?
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.

Archived

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

×
×
  • Create New...

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.