thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

Good Day to you Your Video is great and educaitng #216

Open henryfalon opened 7 years ago

henryfalon commented 7 years ago

Your video is educating and I have learnt a lot already but I have an issue in the 10th video about using url to load content with $_GET as i added the echo $_GET ['pages']; saved it and checked my web page it showed Notice: Undefined index: page in C:\xampp\htdocs\atomcms\index.php on line 43 please i started afresh wrote all your codes letter to letter but i still have the error please can you tell me what i am doing wrong

creptor commented 7 years ago

For those kind of variables you'll always need to check if they where sent or not, that way it doesn't show any errors.

Example:

if(isset($_GET['id'])&&is_numeric($_GET['id'])){
    $id=$_GET['id'];
    // The rest of the code that will execute if $_GET is valid
}
henryfalon commented 7 years ago

Thank You for Your response but with respect to the video should i add the code if(isset($_GET['id'])&&is_numeric($_GET['id'])){ $id=$_GET['id']; // The rest of the code that will execute if $_GET is valid } to the setup.php replacing the id with page

Thank you very much please am new to php <?php

$site_title = 'ATOM CMS';

page setup

$q = "SELECT * FROM menu where id = 1 "; $r = mysqli_query($dbc, $q); $page = mysqli_fetch_assoc($r);

?>

on the home page

<div class= "container">
    <h1><?php   echo $page["header"]; echo $_GET['page']; ?></h1> <!-- ERROR LINE-->
    <p><?php echo $page['body']; ?></p>
</div>  

https://youtu.be/5g2uAnCXwjE?list=PLAkMqlQoeMeiwvNWpe3mhgQxAa1jiGwmt

creptor commented 7 years ago

I can't understand your code correctly, please use: http://pastebin.com/ to upload the file that has the error, in that way it would be more clear to me where the error is and how should you fix it 😝

creptor commented 7 years ago

Please post the hole file