thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

error at part 9 with the associative array #41

Closed bak6i6a closed 10 years ago

bak6i6a commented 10 years ago

I follow your code from the video part 9 . ----------------------------------- first lines from index.php---------------------

<?php 
    include('config/setup.php'); 

    $q = "SELLECT * FROM pages WHERE id = 1";
    $r = mysqli_query($dbc,$q);

}

    $page = mysqli_fetch_assoc($r);  // <--------------------------- line 7

?>
<!DOCTYPE html> 

and i get that error :

i have a result Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in D:\xampp\htdocs\series\dynamic\PacoCMS\index.php on line 7

(without content)

there is on line 45 <?php echo $page['header']; ?> but it is not showing anything after the warning for the mysqli_fetch_assoc. in the video the code has no difference, but i can't get it ,where is the mistake?

thedigicraft commented 10 years ago

i am curious; what is that } doing there above the $page = ....

cucu99 commented 10 years ago

I got the same error but found a solution!

Looks like there was some update and now you have to use this: $q = "SELECT * FROM (character left from 1) pages(character left from 1) WHERE id = 1";

added only (character left from 1)(browser not shows it) around the pages the space also need before pages! unfortunately i don't understand why but i just copied from phpmyadmin/browse tab the code and it's working now.

Chriswilldo commented 10 years ago

There's two L's in your "SELLECT" there should only be one.