I've just started using PDO instead of the mysql functions. But now I'm stuck on a part of my php blog.
How would I make this code a little more PDO friendly:
$total_results = mysql_fetch_array(mysql_query("SELECT COUNT(*) as num
FROM php_blog"));
$total_pages = ceil($total_results['num'] / $blog_postnumber);
for($i = 1; $i <= $total_pages; $i++) {
if ($page == $i) {
echo "<span class='current'>$i</span>";
}
else {
echo "<a href=\"index.php?page=$i\">$i</a>";
}
}
I tried with PDO rowCount(), but it doesn't seem to work...
Sorry for my poor english, I'm from Sweden!