This is my current page:
<?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"); <?php foreach($rows as $row):?> <dl class="standard"> <dt><a href="<?=$row=['link'] ?>" title="<?=$row=['presenter'] ?>"><?=$row['airtime'] . " - " .$row['presenter']?></a></dt> <dd class="itemimg"><a href="<?=$row=['link'] ?>" title="<?=$row=['presenter'] ?>"><img src="<?=$row['image']; ?>" width="100" height="75" alt="<?=$row=['presenter'] ?>" title="<?=$row=['presenter'] ?>" /></a></dd> <dd class="itemdesc"> <?=$row['showinfo']; ?> </dd> <dd class="itemlink"> <a href="<?=$row=['link'] ?>" title="Find out more..."><span> </span> <?=$row['more']; ?></a> </dd> </dl> <?php endforeach;?>
I want to convert this to code that works with PDO since it is included in my php.ini
How can I get PDO to work with this, as I intend (for this project and all future ones) to abandon the use of the older mysql_connect.
I looked at how to do this in the Zend Developer Zone , and although I can do it at a middle level for project-based Dwoo, this template does not use the template engine - it is pure PHP based syntax, without using templates, only various include() and require, plus echo() where necessary.
Any help is appreciated!
source share