PHP Date() is showing incorrect timezone

12,249

Consider using date_default_timezone_set(); and passing in the appropriate timezone identifier for your local timezone.

As for your second question, that is.. well, a separate question and therefore should be its own question on SO. I answered the date question as the title on this question was referring to date :-)

The <iframe> will load whatever page you specify per src=. The dynamic content you output directly there will only be used as fallback. Put your image output code in a separate script, and reference that per <iframe src=images.php>.

@UmmeHabibaKanta the text/data inbetween and is used as HTML to be displayed/rendered by the browser in the event that the browser does not support the iframe tag, otherwise it's completely ignored by the browser. If you want to display something in an iframe, you would put it on an another file and use something like <iframe src="path/to/that/file/you/just/created.php">Sorry, iframes aren't supported by your browser</iframe> -- or as mario said you can put fallback HTML in there, which is, instead of an error message, an alternative to the iframe such as a div with content

Share:
12,249
Umme Habiba Kanta
Author by

Umme Habiba Kanta

Updated on July 21, 2022

Comments

  • Umme Habiba Kanta
    Umme Habiba Kanta almost 2 years

    My current time is 9:05 am. But if i print php date function like

    <?
    php echo date("h:m:s");
    ?>
    

    it's show 4:01 pm. What's the issue. I want to show my current time with php.

    And

    I want to use an html iframe in my index page to show some dynamic content. I use following code, but it doesn't show my dynamic content.

    <div id="eaturlink">
    <iframe src="index.php" width="620">
    <?php
    
    $linkimgpath = 'secure/content/featurelink';
    
    $sql_k = mysql_query("SELECT * FROM feature_detail");
    while ($link = mysql_fetch_assoc($sql_k))
    {
    $linkname = $link['linkname'];
    $linkimg = $link['img_name'];
    $linktext = $link['linkurl'];
    ?>
    <div class="linkimg">
    
    <?php
    
    echo "<a href='$linktext' target='_blank'>$linkname</a>";
    echo "<br/>";
    echo '<img src="' . $linkimgpath . '/' . $linkimg . '" width="125" height="85" alt="No 
    Image" />  ';
    
    ?>
    
    </div>
    <?php
    }   
    ?>
    </iframe>   
    </div>
    

    Any solutions?

  • WhiskeyTangoFoxtrot
    WhiskeyTangoFoxtrot over 12 years
    And I had stated, it's HTML parsed by the browser in the event that the browser does not support iframes. And good team work, @mario