Jump to content
#FlattenTheCurve ×
MH90

PHP and HTML Showing Problem

Recommended Posts

<?php
  include 'includes/header.php';
  include 'includes/navbar.php';
  include 'includes/leftSidebar.php';
?>



<?php 
                                
                          if(isset($_GET['update'])){
                          $the_mentor_id = $_GET['update'];
                                        
                          $query = "SELECT * FROM mentor WHERE mentor_id = '$the_mentor_id' ";
                                        
                          $update_mentor = mysqli_query($db, $query);
                     
                         while ( $row = mysqli_fetch_assoc($update_mentor) ) {
                         $mentor_id  = $row['mentor_id'];
                         
                             
                         ?>
                            
                                 <h1>i am h1</h1>
                             
                         <?php 
                            
                         
                         }

                            }
                                
                                
                        ?>




<?php
  include 'includes/footer.php';
?>

Why <h1> I am h1</h1> this line is not showing, I am totally new in PHP , Please Help me

Share this post


Link to post
Share on other sites

You probably have an error that stops the page executing.

Turn on error reporting in your php.ini file.

Share this post


Link to post
Share on other sites

OR you don't have any query results to loop thru.

Here's a cleaned up version of your current code.

<?php
if(isset($_GET['update']))
{
    $the_mentor_id = $_GET['update'];
    $query = "SELECT mentor_id, field2, field3, field4,..... FROM mentor 
            WHERE mentor_id = '$the_mentor_id' ";
    $qresults = mysqli_query($db, $query);
    while ($row = mysqli_fetch_assoc($qresults)) 
    {
        $mentor_id  = $row['mentor_id'];
        echo "<h1>i am h1</h1>";
    }
}
include 'includes/footer.php';

Question - Does the "footer.php" actually contain php code or is it the footer of your html page?   Don't name it .php if it is just html code

You need to start using prepared queries.  Check out the manual.  And if you are really new, read the PDO stuff instead of the MySQLI stuff.  It's easier and better for you.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.