This topic is locked

How to get first row record values from selected record in list page

1/4/2014 5:08:55 PM
PHPRunner General questions
T
Tayyab Ilyas author

I have a situation where i need to select some record and then out of selected record i need to get value of first row. I want to achieve this in button so i am using DAL. Got selected record using following code but how to get record of first row out of it. any suggestions?



global $dal;

while ( $data = $button->getNextSelectedRecord() ) {

$sql = "Update shipment_details set Debit_No='".$params['status']."' where Shipment_Line_No=".$data["Shipment_Line_No"];

CustomQuery($sql);

}


Sergey Kornilov admin 1/4/2014

You code look correct. When it's executed first time it will update the first selected record.

T
Tayyab Ilyas author 1/7/2014

Let me reword my question, i am using following code, now when i am inserting Debit_No in another table debit_notes i also wants to insert data['Customer_Name'] in database column customer_name but i dont know how to get customer name from the first row/set of data.



global $dal;

while ( $data = $button->getNextSelectedRecord() ) {

$sql = "Update shipment_details set Debit_No='".$params['status']."' where Shipment_Line_No=".$data["Shipment_Line_No"];

CustomQuery($sql);

}
$sqldebit = "INSERT INTO debit_notes (Debit_No) values

('".$params['status']."')";

CustomQuery($sqldebit);
$result['DNID']=$params['status'];


T
Tayyab Ilyas author 1/13/2014

Any support here?