Kahuki Webmaster Forum  

Go Back   Kahuki Webmaster Forum > Website Development & Management > Programming > PHP

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-05-2007, 02:11 PM
Member
 
Join Date: Oct 2006
Posts: 71
baggiho is on a distinguished road
PHP configuration help (inline PHP not working)?

I am having problems getting inline PHP to work correctly. If I do
"""
<?php
printf("<html><body><p>The time is %s.</p></body></html>", date("g:i a", time()));
?>
"""
it will print "The time is 10:08 am."

However, if I do
"""
<html><body><p>The time is <?php date("g:i a", time()) ?>.</p></body></html>
"""
all I get is "The time is ." printed to the screen. What am I missing in either php.ini or http.conf to get this inline php to work correctly.

Reply With Quote
  #2 (permalink)  
Old 01-05-2007, 03:36 PM
Rookie
 
Join Date: Jan 2006
Posts: 5
Frank# is on a distinguished road
Your second statement is missing an echo command.

<?php echo date("g:i a", time()) ?>

Reply With Quote
  #3 (permalink)  
Old 01-06-2007, 09:58 PM
Rookie
 
Join Date: Jun 2007
Posts: 2
jersey is on a distinguished road
Hello
You had forgotten echo or print command for date
Please use
<html><body><p>The time is <?php echo date("g:i a", time()) ; ?>.</p></body></html>

you can do like follow commands(dont forget ; after any coomand too)
<? $var=date("g:i a", time()) ; echo $var; ?>
<?=date("g:i a", time()) ;?>

<?= means echo(print too)

you can use date("g:i a") instead of date("g:i a", time()) ; too.
visit this link for date:
http://php.net/manual/en/function.date.php
and for print:
http://php.net/manual/en/function.echo.php

Have a good times

Reply With Quote
  #4 (permalink)  
Old 01-24-2008, 09:35 AM
Rookie
 
Join Date: Jan 2008
Posts: 1
Ledmik is on a distinguished road
I know this is a VERY old post, but it's the first result I got on a Google search with the exact same problem that took a while to figure out.

The short_open_tag must be on in your php.ini for <?"This to work"?>. Otherwise, you must use <? echo "This to work"; ?>

php.ini
short_open_tag = On

Hope this helps someone in the future.

Mike

Reply With Quote
  #5 (permalink)  
Old 03-03-2008, 06:24 AM
Rookie
 
Join Date: Mar 2008
Posts: 1
johnstanley is on a distinguished road
Post PHP configuration help

Hi,
I found this site http://www.slackware.com/config/packages.php from google search .You can find all the solutions of the problems of PHP configuration.

__________________
642-453 and 70-554

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 5: Configuration file path says c:\windows, but there is no php.ini in there?? sellinsomestuff PHP 3 05-17-2008 03:52 PM
Default Wii-Mote (remote 1) is no longer working. How do remove Wii-mote 1, & replace with working Wii-mote? ju General Discussions 2 03-09-2007 02:31 AM
htaccess not working? veramarose Web Hosting 1 01-22-2007 05:11 AM
ASP.NET Configuration page times out? graduatehills Programming 2 03-27-2006 11:05 AM
php / apache configuration problem: apache not parsing php correctly? macca PHP 2 03-14-2006 07:23 AM


All times are GMT. The time now is 09:38 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0