Announcement

Collapse
No announcement yet.

How To Display In iFrame A Url From Mysql ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Display In iFrame A Url From Mysql ?

    Here is latest update of the code but still it shows not the variable value as the iframe url. Variable calls db row data.
    iFrame supposed to open to the url mentioned in the variable. The variable gets the data from the db row: Latest_View.
    I get no errors, though!

    PHP Code:

    <html>
    <head>
    <title>
    <?php
    $user Home Page
    ?>
    </title>
    </head>
    <body>
    <body background=".png">

    <?php
    session_start
    ();
    require 
    "conn.php";

    /*Check if user is logged-in or not by checking if session is set or not. 
    If user is not logged-in then redirect to login page. Else, show user's account homepage.*/

    if(!isset($_SESSION["user"])) 
    {
        
    header("location:login.php");
    }
    else 
    {
        
    $user $_SESSION["user"];
        
    $sql "SELECT * FROM $user WHERE Username = '".$user."'";
        
    $result $conn->query($sql);
        while(
    $row $result->fetch_assoc()) 
        {
            
    $db_id $row["Id"];
            
    $db_username $row["Username"];
            
    $db_forename $row["Forename"];
            
    $db_surname $row["Surname"];
            
    $db_email $row["Email"];
            
    $db_bio $row["Bio"];
            
    $db_latest_view $row["Latest_View"];
        
        
            
    //Welcome user by name.
            
    echo "<center>Welcome <b><h2>$db_forename $db_surname!</center>"?></h2></b>|

            <?php
            
    //Display log-out link.
            
    echo "<p align='right'><a href='logout.php'>$user Log Out</a>";?>|</p><br>
        
            <?php 
            
    //Display User Bio.
            
    echo "<br><b>Bio:</b><br>";
            echo 
    "$db_bio";?><br>
            <br>
            
            <?php 
            
    //Display User's Latest View.
            
    echo "<br><b>Latest View:</b><br>";
            echo 
    "$db_latest_view";?><br>
            <br>

            <?php 
            
    //Display User's Latest Viewed Url in iFrame.?>
            <iframe src="<?php $db_latest_view;?>"></iframe>
            <?php             
        
    }
    }
    ?>

    </body>
    </html>
Working...
X