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?
Link to comment
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]

----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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.