Jump to content

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

Link to comment
https://forums.phpfreaks.com/topic/310351-php-and-html-showing-problem/
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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.