logo       

DataObject: upgrade from 1.2 to 1.3 problems: msg#00397

php.pear.general

Subject: DataObject: upgrade from 1.2 to 1.3 problems

Hi,

I've posted this problem last week but unfortunately got no answers. I'll try again with some more detailed info.
After upgrading from 1.2 to 1.3 I'm experiencing some problems. The following code now gives me errors:

// pagination init
$params['totalItems'] = $eventRows->find();
$params['perPage'] = 20;
$pager = &new Pager($params);
$links = $pager->getLinks();
list($from, $to) = $pager->getOffsetByPageId();
?>
<table style="width:100%;">
<tr>
<td style="text-align:left;">
<form method="get" action="<?=$_SERVER['PHP_SELF']?>">
Show Events owned by:&nbsp;
<select name="filter" onchange="this.form.submit();">
<?
// selectbox with usernames to filter the list of tasks
$possibleFilters = array_merge(array("ALL"=>"All&nbsp;"), $PERSONS);
foreach ($possibleFilters as $value => $label) {
echo '<option value="'.$value.'"'; if ($value==$_SESSION[appName]['filter']) { echo 'selected="selected"'; } echo '>'.$label.'</option>';
}
?>
</select>
&nbsp;<input type="Checkbox" name="hideold" value="true" class="checkbox" onclick="this.form.submit();" <? if ($_SESSION[appName]['hideold']==true) { echo 'checked'; }?>/>Hide past events
</td>
<td style="text-align:right;">[<a href="form.php">Add Event</a>]<br />[<a href="calendar.php">Calendar View</a>]</td>
</tr>
</table>
<input type="Hidden" name="action" value="setoptions" />
</form>
<br />
<table style="width:100%;" cellpadding="4" cellspacing="0">
<?
$dataGrid = new DataGrid(appName);
$dataGrid->setIcons('/gfx/ASC.gif','/gfx/DESC.gif');
$dataGrid->addHeaderCol('name','Event',30);
$dataGrid->addHeaderCol('city','City',10);
$dataGrid->addHeaderCol('starts','Starts',10);
$dataGrid->addHeaderCol('ends','Ends',10);
$dataGrid->addHeaderCol(null,'&nbsp;',20);
$dataGrid->setDefaultOrderBy('starts','ASC');
echo $dataGrid->getHeader();
// fetch rows
$eventRows->orderBy($_SESSION[appName]['orderby'].' '.$_SESSION[appName]['dir']);
$eventRows->selectAdd("UNIX_TIMESTAMP(starts) AS start_stamp");
$eventRows->selectAdd("UNIX_TIMESTAMP(ends) AS end_stamp");
// limit number of rows fetched
$eventRows->limit($from-1, $params['perPage']);
$eventRows->find();

var_Dump($eventRows); // for debug

while ($eventRows->fetch()) {
$event = $eventRows->__clone();
echo '<tr>';
echo '<td>'.$event->name.'</td>';
echo '<td>'.$event->city.'</td>';
echo '<td>'.date("M jS Y",$event->start_stamp).'</td>';
echo '<td>'.date("M jS Y",$event->end_stamp).'</td>';
echo '<td align="right" nowrap="nowrap">
<a href="form.php?eventID='.$event->eventID.'"><img src="/gfx/buttons/edit.gif" border="0" alt="Show Details / Edit" /></a>
<a href="'.$_SERVER['PHP_SELF'].'?action=delItem&amp;itemID='.$event->eventID.'" onclick="return confirm(\'Delete?\');"><img src="/gfx/buttons/trash.gif" border="0" alt="Delete" /></a>
&nbsp;[<a href="/events/?eventID='.$event->eventID.'" target="_blank">See page</a>]</td>';
echo '</tr>';
}
?>
</table>

thw Var_Dump() call gives me a message:

You cannot do two queries on the same object (copy it before finding)

Also I get notices:

Notice: Undefined property: start_stamp in xxx on line 99
Notice: Undefined property: end_stamp in xxx on line 100

This must have something to do with the selectAdd not working as it worked
before (?)

Help much appreciated,

Jeroen

--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise