<?php try { $user = 'root'; $pass = ''; $PDO = new PDO('mysql:host=localhost;dbname=mike', $user, $pass); $PDO->exec("set names utf8"); $query = "SELECT SUM(likes) as test FROM news WHERE autor=".$_SESSION['id'].""; $c_query = $PDO->prepare($query; $c_query->execute(); $results = $c_query->fetch(PDO::FETCH_ASSOC); if($results) { echo "Total number of likes: ".$f_test = $results['test']; } } catch(PDOException $e) { echo "Error: " .$e; } ?>
$rCount= $PDO->query($query)->fetchColumn(); echo '<br/> Total number of likes: '.$rCount;
foreach($db->query('SELECT YourDateColumn FROM news WHERE autor='.$_SESSION['id']) as $row) { echo $row['YourDateColumn']; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)