hope this is the right place to post...
since i moved my webserver to winxp pro i get the following error
warning: use of undefined constant mon assumed 'mon' in i:\http\index.inc online x
the soure is like this
if ($date[mon]==1) { $date[mon]=01;}
so what ... it worked in win98 and i just copied it over!
here is what i use to serve:
php: 4.1.1
apache: 1.3.27
php is loaded in apache via cgi binary (install.txt)
if iam using the newest php this error goes away and a new one comes up:
if i write a link like <a href='index.php?ref=link'>link</a>
and the sourece is like this:
switch ($ref) {
case 'link': include ("data/link.inc");
break;
}
it simply dont work
this one is also just copyed from win98
so if anyone knows what php / apache versions i should use with winxp pro and how to include php in apache
please write back! ... you may also write if you know a solution for the problems.
greetings from germany
netter
php error on winxp
Moderator: General Moderators
Read the error reporting config comments in your php.ini or alternatively http://au.php.net/error_reporting
As for the warning, to avoid it you need to check if the array index exists first before comparing it with a value.
As for the warning, to avoid it you need to check if the array index exists first before comparing it with a value.
Code: Select all
if(isset($dateїmon]))
{
if ($dateїmon]==1) { $dateїmon]=01;}
}For the first problem, in php when you access elements in an array you should use quotes.
What PHP does with this is it first looks for a constant named 'mon'. When it doesn't find it, it assumes that you meant the string 'mon'. What you should write is this:
That should get rid of your error.
For the second problem, new versions of php by default do not register request variables as global variables.
If you really need this behaviour, then change make register_globals = On in your php.ini file. However, what you should do is this:
Take a look at the manual for pre-defined variables: http://uk.php.net/manual/en/language.va ... efined.php
Regards,
Kelvin
Code: Select all
<?php
if ($date[mon]==1) { $date[mon]=01;}
?>Code: Select all
<?php
if ($date['mon']==1) { $date['mon']=01;}
?>For the second problem, new versions of php by default do not register request variables as global variables.
If you really need this behaviour, then change make register_globals = On in your php.ini file. However, what you should do is this:
Code: Select all
<?php
switch ($_GET['ref']) {
case 'link': include ("data/link.inc");
break;
}
?>Regards,
Kelvin
all right ..
ok boys, thank you very much...
i think i can work with that stuff as long as my provider dosnt switches register variables off (will be a lot of work)
thanks again ...
i think i can work with that stuff as long as my provider dosnt switches register variables off (will be a lot of work)
thanks again ...