Just for you all to know, im starting to learn PDO so dont get mad at me :)
When i was using mysqli i would do this get the result from a query and echo something:
$query2= "SELECT acess FROM statistic WHERE id_page IN(SELECT id FROM page WHERE title='".$registos1['title']."')";
$result2 = mysqli_query($ligaBD,$query2);
$registos2 = mysqli_fetch_array($result2);
if($registos2['acess']==0){
echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>...</title></head><body>This page is private.</body></html>';exit;
And now im trying to do it on PDO but im not shure if it is like is:
$sql = "SELECT acess FROM statistic WHERE id_page IN(SELECT id FROM page WHERE title=?)";
$stm = $ligaBD->prepare($sql);
$stm->execute(array($acess));
$stm->fetchColumn();
if(($row = $stm->fetch(PDO::FETCH_ASSOC))){
echo '<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Easy Page Builder</title></head><body>This page is private.</body></html>';exit;
}
This if($registos2['acess']==0){
does the same thing as this if(($row = $stm->fetch(PDO::FETCH_ASSOC))){
?
What is the value returned from fetch(PDO::FETCH_ASSOC) ? I have read that is boolean but im not shure if this is even the proper code to use to get the result from the query like i was doing in the past when using mysqli.
Thanks.