title: Using PDO to replace mysql_connect - formatting correctly?
body: <p>This is my current page:</p>
  
  <pre><code>&lt;?php
  
  mysql_connect('localhost', 'root', 'mypass') or die (mysql_error());
  mysql_select_db('radio1') or die (mysql_error());
  $result = mysql_query("SELECT *, TIME_FORMAT(airtime, '%H:%i') `airtime` 
  from presenters");
  //Table starting tag and header cells
  while($row = mysql_fetch_array($result)) {
  ?&gt;
      &lt;?php foreach($rows as $row):?&gt;
          &lt;dl class="standard"&gt;
              &lt;dt&gt;&lt;a href="&lt;?=$row=['link'] ?&gt;" title="&lt;?=$row=['presenter'] ?&gt;"&gt;&lt;?=$row['airtime'] . " - " .$row['presenter']?&gt;&lt;/a&gt;&lt;/dt&gt;
              &lt;dd class="itemimg"&gt;&lt;a href="&lt;?=$row=['link'] ?&gt;" title="&lt;?=$row=['presenter'] ?&gt;"&gt;&lt;img src="&lt;?=$row['image']; ?&gt;" width="100" height="75" alt="&lt;?=$row=['presenter'] ?&gt;" title="&lt;?=$row=['presenter'] ?&gt;" /&gt;&lt;/a&gt;&lt;/dd&gt;
              &lt;dd class="itemdesc"&gt;
                  &lt;?=$row['showinfo']; ?&gt;
              &lt;/dd&gt;
              &lt;dd class="itemlink"&gt;
                 &lt;a href="&lt;?=$row=['link'] ?&gt;" title="Find out more..."&gt;&lt;span&gt; &lt;/span&gt;
                          &lt;?=$row['more']; ?&gt;&lt;/a&gt;
  
              &lt;/dd&gt;
          &lt;/dl&gt;
      &lt;?php endforeach;?&gt;
  </code></pre>
  
  <p>I want to convert this to code that works with PDO, since it is enabled in my php.ini</p>
  
  <p>How would I get PDO to work with this, as I'm intending on (for this project and all future ones) phasing out use of the older mysql_connect.</p>
  
  <p>I had a look at how to do it at the <a href="https://devzone.zend.com/1746/building-template-driven-web-applications-with-dwoo-part-1/" rel="nofollow noreferrer">Zend Developer Zone</a> and although I can do it at an average level for Dwoo-based projects, this template <strong>does not</strong> use a templating engine - it is pure PHP-based syntax, no templates used, only various <code>include()</code> and require, plus <code>echo()</code> where needed.</p>
  
  <p>Any help is appreciated!</p>