Reputation: 163
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?
Upvotes: 4
Views: 12701
Reputation: 19
I had the same problem and the solution was to set the correct longitude and latitude in php.ini. my timezone is America/Los_angeles, so, in php.ini that section looks like this:
[Date]
; Defines the default timezone used by the date functions
date.timezone = America/Los_Angeles
date.default_latitude = 34.05222
date.default_longitude = -118.24278
;date.sunrise_zenith = 90.583333
;date.sunset_zenith = 90.583333
Upvotes: 0
Reputation: 644
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
Upvotes: 2