title: Echo results of mysql query with php
body: <p>I have this query</p>
  
  <pre><code>$people = "SELECT name FROM people";
  $people = mysql_query($people) or die(mysql_error());
  $row_people = mysql_fetch_assoc($people);
  $totalRows_people = mysql_num_rows($people);
  </code></pre>
  
  <p>I can echo the results within a unordered list using a while loop like this</p>
  
  <pre><code>&lt;ul&gt;
  
  &lt;?php {do { ?&gt;
  
      &lt;li&gt;&lt;?php echo $row_people['name'];?&gt;&lt;/li&gt; 
  
  &lt;?php } while ($row_people = mysql_fetch_assoc($people));}?&gt;
  
  &lt;/ul&gt;
  </code></pre>
  
  <p>But I can't used this as my html does not allow it.</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li class="first"&gt;
          &lt;a href="?name=kate"&gt;Kate&lt;/a&gt;
      &lt;li&gt;
      &lt;li class="second"&gt;
          &lt;a href="?name=john"&gt;&lt;img src="john.jpg" /&gt;John&lt;/a&gt;
      &lt;li&gt;
      &lt;li class="third"&gt;
          &lt;a href="?name=max"&gt;&lt;span&gt;Max&lt;/span&gt;&lt;/a&gt;
      &lt;li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>My question is how can echo the name that was retrieved from the database into the appropriate place within this html?</p>
  
  <p>Thanks for your help.</p>