#1  
Old 15th March 2013, 05:21 AM
Micael Micael is offline
Member
 
Join Date: Mar 2011
Posts: 78
Default What I'm I doing wrong

In the example I commented what is happening and what I expected to happen

micael

<?php
require_once("rpcl/rpcl.inc.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
use_unit("dbtables.inc.php");
use_unit("db.inc.php");

//Class definition
class Page1 extends Page
{
public $Database1 = null;
// databasename = Your database
// host = localhost
// port = 16000
// drivername = nexus
public $Table1 = null;
// limitcount = -1
// limitstart = -1;
public $First_Button = null;
public $Next_Button = null;
public $Label1 = null;
// Shows the name field
public $Datasource1 = null;
public $Last_Button = null;

// Whithout pushing any button it starts with showing the first record

function First_ButtonClick($sender, $params)
{
$this->Table1->first();
// this gives the first record Works OK
//
}
function Next_ButtonClick($sender, $params)
{
$this->Table1->next();
// this is always shows the second record whenever pushed
// I did expect it to step to the next record whenewer pushed
//
}
function Last_ButtonClick($sender, $params)
{
$this->Table1->last();
// gives an error 'Table1: Operation not allowed on a unidirectional dataset'
//

}

}

global $Page1;

//Creates the form
$Page1=new Page1($application);

//Read from resource file
$Page1->loadResource(__FILE__);

//Shows the form
$Page1->show();

?>
  #2  
Old 17th March 2013, 06:34 PM
Alexander Telegin [NDX]
 
Posts: n/a
Default Re: What I'm I doing wrong

Could you please also provide your DB dump (send at alexander@nexusdb.com)

On 3/14/2013 9:21 PM, Micael wrote:
> In the example I commented what is happening and what I expected to
> happen
>
> micael
>
> <?php
> require_once("rpcl/rpcl.inc.php");
> //Includes
> use_unit("forms.inc.php");
> use_unit("extctrls.inc.php");
> use_unit("stdctrls.inc.php");
> use_unit("dbtables.inc.php");
> use_unit("db.inc.php");
>
> //Class definition
> class Page1 extends Page
> {
> public $Database1 = null;
> // databasename = Your database
> // host = localhost
> // port = 16000
> // drivername = nexus
> public $Table1 = null;
> // limitcount = -1
> // limitstart = -1;
> public $First_Button = null;
> public $Next_Button = null;
> public $Label1 = null;
> // Shows the name field
> public $Datasource1 = null;
> public $Last_Button = null;
>
> // Whithout pushing any button it starts with showing the first record
>
> function First_ButtonClick($sender, $params)
> {
> $this->Table1->first();
> // this gives the first record Works OK
> //
> }
> function Next_ButtonClick($sender, $params)
> {
> $this->Table1->next();
> // this is always shows the second record whenever pushed
> // I did expect it to step to the next record whenewer pushed
> //
> }
> function Last_ButtonClick($sender, $params)
> {
> $this->Table1->last();
> // gives an error 'Table1: Operation not allowed on a unidirectional
> dataset'
> //
>
> }
>
> }
>
> global $Page1;
>
> //Creates the form
> $Page1=new Page1($application);
>
> //Read from resource file
> $Page1->loadResource(__FILE__);
>
> //Shows the form
> $Page1->show();
>
> ?>
>
>


  #3  
Old 19th March 2013, 06:10 AM
Alexander Telegin [NDX]
 
Posts: n/a
Default Re: What I'm I doing wrong

Ah, I see your problem. No, this code won't work as you expected. You
will always get the second record as PHP doesn't store dataset between
requests (you can check with other drivers). For your scenario need to
store row number in session (or transfer it through URI or POST) and
then point recordset at specific row before to render the result:

<?php
require_once("rpcl/rpcl.inc.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
use_unit("dbtables.inc.php");
use_unit("db.inc.php");

//Class definition
class Page1 extends Page
{
public $Query1 = null;
public $Datasource1 = null;
public $Database1 = null;
public $Next_Button = null;
public $Label1 = null;
function Next_ButtonClick($sender, $params)
{
if ( !isset( $_SESSION[row_number] ) ) $_SESSION[row_number] = 1;
$this->Query1->setSQL("SELECT TOP 1,$_SESSION[row_number]
aLastName FROM Persons");
$this->Query1->open();
$this->Query1->first();
$_SESSION[row_number] += 1;
$this->Label1->setDataField('aLastName');
}
}

global $application;

global $Page1;

//Creates the form
$Page1=new Page1($application);

//Read from resource file
$Page1->loadResource(__FILE__);

//Shows the form
$Page1->show();

?>



On 3/14/2013 9:21 PM, Micael wrote:
> In the example I commented what is happening and what I expected to
> happen
>
> micael
>
> <?php
> require_once("rpcl/rpcl.inc.php");
> //Includes
> use_unit("forms.inc.php");
> use_unit("extctrls.inc.php");
> use_unit("stdctrls.inc.php");
> use_unit("dbtables.inc.php");
> use_unit("db.inc.php");
>
> //Class definition
> class Page1 extends Page
> {
> public $Database1 = null;
> // databasename = Your database
> // host = localhost
> // port = 16000
> // drivername = nexus
> public $Table1 = null;
> // limitcount = -1
> // limitstart = -1;
> public $First_Button = null;
> public $Next_Button = null;
> public $Label1 = null;
> // Shows the name field
> public $Datasource1 = null;
> public $Last_Button = null;
>
> // Whithout pushing any button it starts with showing the first record
>
> function First_ButtonClick($sender, $params)
> {
> $this->Table1->first();
> // this gives the first record Works OK
> //
> }
> function Next_ButtonClick($sender, $params)
> {
> $this->Table1->next();
> // this is always shows the second record whenever pushed
> // I did expect it to step to the next record whenewer pushed
> //
> }
> function Last_ButtonClick($sender, $params)
> {
> $this->Table1->last();
> // gives an error 'Table1: Operation not allowed on a unidirectional
> dataset'
> //
>
> }
>
> }
>
> global $Page1;
>
> //Creates the form
> $Page1=new Page1($application);
>
> //Read from resource file
> $Page1->loadResource(__FILE__);
>
> //Shows the form
> $Page1->show();
>
> ?>
>
>


  #4  
Old 19th March 2013, 10:35 AM
Eivind Bakkestuen [NDD]
 
Posts: n/a
Default Re: What I'm I doing wrong

> Ah, I see your problem. No, this code won't work as you expected. You
> will always get the second record as PHP doesn't store dataset
> between requests (you can check with other drivers). For your
> scenario need to store row number in session (or transfer it through
> URI or POST) and then point recordset at specific row before to
> render the result:


Does information like this exist in a PHP FAQ on the internet somewhere?


--
Eivind Bakkestuen [NDD]
  #5  
Old 20th March 2013, 02:39 AM
Alexander Telegin [NDX]
 
Posts: n/a
Default Re: What I'm I doing wrong

> Does information like this exist in a PHP FAQ on the internet somewhere?

Sure, this is PHP basics.

On 3/19/2013 2:35 AM, Eivind Bakkestuen [NDD] wrote:
>> Ah, I see your problem. No, this code won't work as you expected. You
>> will always get the second record as PHP doesn't store dataset
>> between requests (you can check with other drivers). For your
>> scenario need to store row number in session (or transfer it through
>> URI or POST) and then point recordset at specific row before to
>> render the result:

>
> Does information like this exist in a PHP FAQ on the internet somewhere?
>
>


  #6  
Old 20th March 2013, 11:55 PM
Micael Micael is offline
Member
 
Join Date: Mar 2011
Posts: 78
Default

Many thanks

My knowledge is from pascal programing so I wonder why there in PHP is a function such as "next" when it's not working.
  #7  
Old 21st March 2013, 12:01 AM
Alexander Telegin [NDX]
 
Posts: n/a
Default Re: What I'm I doing wrong

It works perfectly in context of a single request, but I agree, it's
confusing. Probably, it's an attempt to make HTML5 Builder look like Delphi.


On 3/20/2013 3:55 PM, Micael wrote:
> Many thanks
>
> My knowledge is from pascal programing so I wonder why there in PHP is a
> function such as "next" when it's not working.
>
>




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
nxSqlUpdateObject: What am I doing wrong? Ric nexusdb.public.support.sql 8 26th February 2012 06:36 AM
NXDDCG -- I'm doing something wrong David Guest nexusdb.public.support 2 29th June 2008 08:16 AM
What is wrong in this SQL Bernhard Roos nexusdb.public.support.sql 1 24th December 2005 12:24 AM
What am I doing wrong? Srinivasan Iyer nexusdb.public.support.sql 4 27th November 2003 02:44 PM
wrong pwd? Umberto Di Gioia nexusdb.public.support 6 24th August 2003 06:45 AM


All times are GMT +11. The time now is 07:16 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.