Subject | "Mimmo... Using Ibase functions |
---|---|
Author | dogrocket2003 |
Post date | 2008-10-13T20:48:23Z |
Mimmo, heres the example I was trying to get to allow me to
sequentially access records in a dataset, at this time everything
works except the next function... Is there a better way than my method?
Also does IBASE have a Top function? , is there a manual way to get
back to top of dataset, aside from posting form? This is important if
your scanning a dataset for a match and nothing is found, and you want
to return user to either top or last record (cursor) position.
Whats most secure way to retain current record positon from one page
load to next?
Thanks ahead of time!
`<?php
// Example of jumping to specific records in a DATASET , sequentialy
like a regular file
// Rev 1.0 dogrocket
require_once("vcl/vcl.inc.php");
// use_unit("ibase.inc.php");
//use_unit("dbctrls.inc.php");
//use_unit("dbgrids.inc.php");
//use_unit("db.inc.php");
//use_unit("interbase.inc.php");
//use_unit("dbtables.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
$conn = ibase_connect("JAYS-PC:C:/DWebsite/files/APPLY.FDB",
"SYSDBA", "masterkey");
$stmt = "Select * From APPLIED";
$iaquery = ibase_query($conn, $stmt);
$rcursor;
//Class definition
class QuerySample extends Page
{
public $displabel = null;
public $Button1 = null;
public $Enterrec = null;
public $datalabel = null;
public $labelinput = null;
function Button1Click($sender, $params)
{
GLOBAL $conn;
GLOBAL $iaquery;
GLOBAL $row;
GLOBAL $stmt;
GLOBAL $rcursor;
// input is either an N for next record, or a number for record
position...
// (( cant get N or next to work
// i must have to pass varible to session, I thought being global
$rcursor would retain value.?? ))
//enterrec is an edit box for user input.. retrieve user input
if($this->Enterrec->text == 'n')
$rcursor = $rcursor + 1;
else
// not an N, set record to jump to users input...
$rcursor = $this->Enterrec->text;
// initialize record counter...
$jumpto = 0;
// while current record position is than our input limit.
while($jumpto < $rcursor && $row != EOF)
{
// retrieve row as an object...
$row = ibase_fetch_object($iaquery);
$jumpto++;
}
//adjust cursor to new record location....
$rcursor = $jumpto;
//show our example data field, at desired row.
// using object reference :-)
$this->displabel->caption = $row->JOB_ID;
}
}
global $application;
global $QuerySample;
//Creates the form
$QuerySample = new QuerySample($application);
//Read from resource file
$QuerySample->loadResource(__FILE__);
//Shows the form
$QuerySample->show();
?>
sequentially access records in a dataset, at this time everything
works except the next function... Is there a better way than my method?
Also does IBASE have a Top function? , is there a manual way to get
back to top of dataset, aside from posting form? This is important if
your scanning a dataset for a match and nothing is found, and you want
to return user to either top or last record (cursor) position.
Whats most secure way to retain current record positon from one page
load to next?
Thanks ahead of time!
`<?php
// Example of jumping to specific records in a DATASET , sequentialy
like a regular file
// Rev 1.0 dogrocket
require_once("vcl/vcl.inc.php");
// use_unit("ibase.inc.php");
//use_unit("dbctrls.inc.php");
//use_unit("dbgrids.inc.php");
//use_unit("db.inc.php");
//use_unit("interbase.inc.php");
//use_unit("dbtables.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
$conn = ibase_connect("JAYS-PC:C:/DWebsite/files/APPLY.FDB",
"SYSDBA", "masterkey");
$stmt = "Select * From APPLIED";
$iaquery = ibase_query($conn, $stmt);
$rcursor;
//Class definition
class QuerySample extends Page
{
public $displabel = null;
public $Button1 = null;
public $Enterrec = null;
public $datalabel = null;
public $labelinput = null;
function Button1Click($sender, $params)
{
GLOBAL $conn;
GLOBAL $iaquery;
GLOBAL $row;
GLOBAL $stmt;
GLOBAL $rcursor;
// input is either an N for next record, or a number for record
position...
// (( cant get N or next to work
// i must have to pass varible to session, I thought being global
$rcursor would retain value.?? ))
//enterrec is an edit box for user input.. retrieve user input
if($this->Enterrec->text == 'n')
$rcursor = $rcursor + 1;
else
// not an N, set record to jump to users input...
$rcursor = $this->Enterrec->text;
// initialize record counter...
$jumpto = 0;
// while current record position is than our input limit.
while($jumpto < $rcursor && $row != EOF)
{
// retrieve row as an object...
$row = ibase_fetch_object($iaquery);
$jumpto++;
}
//adjust cursor to new record location....
$rcursor = $jumpto;
//show our example data field, at desired row.
// using object reference :-)
$this->displabel->caption = $row->JOB_ID;
}
}
global $application;
global $QuerySample;
//Creates the form
$QuerySample = new QuerySample($application);
//Read from resource file
$QuerySample->loadResource(__FILE__);
//Shows the form
$QuerySample->show();
?>