php question

Jared Smith jared at trios.org
Thu Nov 7 09:57:39 CST 2002


In your script, change a coupla things, in addition to changing $thedate to $thetime.

Uppercase 'REMOTE_HOST' and get in the habit of using double quotes for the echos.

Double quotes have the property of asking PHP to translate special characters inside of them. The 
contents of single quotes are interpreted as completely literal (and can 'enclose "double" quotes' 
when needed), thus your echo line with a linebreak is where your script is breaking. If you enclose 
the linebreak like this: "
" in double quotes, it will work.

Also, one thing you can do with double quotes that you cannot do with single quotes is include a 
$variable name like so:

echo "Time: $thedate";

---------------------------------------------------------

> $thedate = date('H:n');
> $theIP = $HTTP_SERVER_VARS['remote_host'];
>
> echo 'Your IP: '.$theIP;
> echo '
> ';
> echo 'Time: '.$thetime;
>
> (minus quotes of course) and here is the error showing
> up on my site:
> 
> '; echo 'Time: '.$thetime; ?> 




More information about the Kclug mailing list