This topic is locked
[SOLVED]

 replacing name_id with real name

7/12/2011 11:41:48 AM
PHPRunner General questions
A
Andrzej author

Hi

I would like to ask what should I do to insert to one field data from another table.

I have table "invoices" with foreign key 'client_id' from "clients" table.

I want replace show information in field 'client_id' and show client details from table "clients" 'client_name' + 'client_surname'

Andrew

C
cgphp 7/12/2011

You can set the client_id field as Custom: http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm
Paste this code in the custom field:

global $conn;

$strSQL = "SELECT client_name, client_surname from clients where id =".$value;

$rs = db_query($strSQL,$conn);

$record = db_fetch_array($rs);
$value = $record['client_name'] . " " . $record['client_surname'];
A
Andrzej author 7/14/2011



You can set the client_id field as Custom: http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm
Paste this code in the custom field:

global $conn;

$strSQL = "SELECT client_name, client_surname from clients where id =".$value;

$rs = db_query($strSQL,$conn);

$record = db_fetch_array($rs);
$value = $record['client_name'] . " " . $record['client_surname'];



Thanks Cristian. It works