undefined variables

undefined variables

Postby zebedee » Fri Sep 25, 2009 10:42 am

Hi there,

I have followed the install instructions for the availability calendar and installed on my localhost.

When I run the index.php file as requested I get a long list of errors like bellow:-

Notice: Undefined index: day_3 in C:\Program Files\EasyPHP 3.0\www\availabilty_calendar\includes\functions.inc.php on line 103

All errors are undefined index errors for all the days.

What have I done wrong? I have checked the config file and the connection to the database is fine.

Cheers.
zebedee
 
Posts: 1
Joined: Fri Sep 25, 2009 10:37 am

Re: undefined variables

Postby chris » Fri Sep 25, 2009 11:50 am

Hi,
You are not doing anything wrong.
You are getting these errors because your server is set to show all php errors-
The messages that you are getting are not actually errors, rather they are "noticies" which are informing you that each variable has not been defined.
In php it is not a requirement to define the variable before assigning it a value (for better or for worse).
You should be able to desactivate these noticies by adjusting the php error level, either in your php.ini file or in the php code itself.
To change this in your code, place this at the top of the code:

error_reporting(E_ERROR | E_WARNING | E_PARSE);

More info can be found here: http://us2.php.net/manual/en/function.e ... orting.php

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: undefined variables

Postby chris » Fri Sep 25, 2009 8:40 pm

sorry, that probably should have been:

error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors", 1);

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron