Jump to content


Photo

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


  • Please log in to reply
1 reply to this topic

#1 Techbot

Techbot
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 27 August 2006 - 03:14 PM


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

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?


#2 Techbot

Techbot
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 27 August 2006 - 04:06 PM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users