How to get a field value in details mode?

Talk about programming tricks and examples

Moderator: alexandrleonenko

chirng
Master
Master
Posts: 148
Joined: Jun 7th, '09, 04:15

How to get a field value in details mode?

Postby chirng » Nov 22nd, '10, 05:43

How to get a field value in details mode? Please advise,
Last edited by chirng on Nov 22nd, '10, 11:04, edited 1 time in total.

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to get a field value in details more?

Postby administrator » Nov 22nd, '10, 09:33

Where and how exactly you need to do this?

chirng
Master
Master
Posts: 148
Joined: Jun 7th, '09, 04:15

Re: How to get a field value in details mode?

Postby chirng » Nov 22nd, '10, 11:04

I would like to get a field value from the same mysql in details mode,

if(($mode == "details") && $rid != "-1"){
$agent_id = (isset($_REQUEST['snyagentId']) ? sprintf('%03s', $_REQUEST['snyagentId']) : "");
}

$em_columns = array(
"agentId" =>array("header"=>"Agent", "type"=>"label", "width"=>"100px", "req_type"=>"sn"),
...............

it is not working, please advise

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to get a field value in details mode?

Postby administrator » Nov 23rd, '10, 08:22

Such method you may use only in Edit mode.

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to get a field value in details mode?

Postby administrator » Nov 23rd, '10, 08:26

Such method you may use only in Edit mode in Details mode you can not.

chirng
Master
Master
Posts: 148
Joined: Jun 7th, '09, 04:15

Re: How to get a field value in details mode?

Postby chirng » Nov 23rd, '10, 08:28

then, I tried as below:-

$rid = (isset($_GET['erc_rid'])) ? $_GET['erc_rid'] : "";$agent_url='';

$sql = "SELECT field1 FROM mytable where xxx = ".$rid;$dSet = $dgrid->executeSql($sql);
while($row = $dSet->fetchRow()){
$agent_url="../xxxx/uploads/".sprintf('%03s', $row[0])."/";
}

Fatal error: Call to undefined method DB_Error::fetchRow() in ...............

Please advise, How to get a field value in details mode?

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: How to get a field value in details mode?

Postby administrator » Nov 24th, '10, 07:13

Here the examples:

## METHOD : ExecuteSQL()
## use it after DataSource() method only (using this method before bind() requires redefinition of DataSource())

Code: Select all

$dSet = $dgrid->ExecuteSQL("SELECT * FROM tblPresidents WHERE tblPresidents.CountryID = ".$_GET['f_rid']."");
while($row = $dSet->fetchRow()){
    for($c = 0; ($c < $dSet->numCols()); $c++){ echo $row[$c]." "; }
    echo "<br />";
}


## --//-- : SelectSqlItem()
## use it after DataSource() method only (using this method before bind() requires redefinition of DataSource())

Code: Select all

$presidents = $dgrid->SelectSqlItem("SELECT COUNT(tblPresidents.presidentID) FROM tblPresidents WHERE tblPresidents.CountryID = ".$_GET['f_rid']."");


Return to “Programming Tricks”