I have a little problem, and since I am very new to all of this, I have not been successful when searching on Google because I do not know the exact definitions for what I am looking for.
I have a very simple database and I get all the rows:
while($row = mysql_fetch_array($result)){ echo $row['id']. " - ". $row['name']; echo "<br />"; }
Now, my question is: how do I filter the second result? I thought something like this might work, but it is not:
$name2= $row['name'][2];
Is it possible? Or do I need to write another mysql query (something like SELECT .. WHERE id = "2"
) to get the name value in the second line?
I am doing my best:
-get all data from the database (with a "while" loop), but individually display specific results on my page. For example echo("name in second row")
and echo("id of first row")
, etc.
source share