This topic is locked

Error Undefined offset

10/20/2006 7:57:30 AM
PHPRunner General questions
S
scy author

Hi
on view mode for some records I get an error message description undefined offset. What does this mean?

J
Jane 10/20/2006

Hi,
it's difficult to tell you what's happening without seeing actual code.

This error occurs when you refer to the non-existent element of array, for example.

S
scy author 10/20/2006

Technical information

Error type 8

Error description Undefined offset: 13

URL -------------------/FixturesRotas/tblfixtures_view.php?editid1=9

Error file /-----------------------------/FixturesRotas/include/locale.php

Error line 676

SQL query select `EventID`, `Day`, `EventDate`, `StartTime`, `HighWater`, `Height`, `Event`, `EventType`, `Details`, `OOD`, `AOOD`, `Safety1`, `Safety2`, `Safety3`, `Bar`, `Galley`, `JuniorBar`, `JuniorGalley`, `LastUpdate`, `UpdateBy` From `tblfixtures` where `tblfixtures`.`EventID`=9


The code refered to is

// returns day of week (1-7) for (monday-sunday)

function getdayofweek($time)

{

// January 1, 2004 - Thursday

// Get the differewnce in days between January 1, 2004 and January 1 of given year

$daydif=0;

if($time[0]>=2004)

{

for($i=2004;$i<$time[0];$i++)

if(isleapyear($i))

$daydif+=366;

else

$daydif+=365;

}

else

for($i=2003;$i>=$time[0];$i--)

if(isleapyear($i))

$daydif-=366;

else

$daydif-=365;

// to given month

$mdays=array(1=>31,28,31,30,31,30,31,31,30,31,30,31);

if(isleapyear($time[0]))

$mdays[2]=29;

for($i=1;$i<$time[1];$i++)

$daydif+=$mdays[$i];------------------------------------line676

// to given day

$daydif+=$time[2]-1;

if($daydif>0)

return (4+$daydif-1)%7 + 1;

return 7-(3-$daydif)%7;

}

Alexey admin 10/23/2006

Hi,
it looks like you use Short date or Long date view format for one of your non-Date fields.
Please note that these formats are suitable for Date or Datetime fields or for character fields with dates in YYYY-MM-DD format.
Check view formats you use in your project.
If this doesn't help zip and send to support@xlinesoft.com a full set of generated PHP files along with your database creation script for investigation.

S
scy author 10/23/2006

Thanks for your help, its working now. It turns out it was not a date field with a problem it was another field which was set to custom format.