This topic is locked
[SOLVED]

 Printer-friendly page

1/8/2011 9:26:19 AM
PHPRunner General questions
D
darcik author

On Printer-friendly page I displaying data from Table1. In this table is field: customer_id, which indicates record from Table2.

I want to display data from Table2["customer_name"]
According to this topic I insert PHP snippet with code:

$id_customer = $data["customer"];

$sql="select * from Table2 where id=$id_customer";

$rs = CustomQuery($sql);

if($new_data=db_fetch_array($rs)){

echo $new_data["customer_name"];

}


When I try to display record on Printer-friendly page, shows up PHP error: Undefined variable: values
How to access the data displayed on the Printer-friendly from Table1? I tried to use: $values, $data.
All working if I put this code to Custom View as for field, ofc echo shows result at top page <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=16058&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' />
Thank in advance for your help.

Sergey Kornilov admin 1/8/2011

This is obviously not the code snippet that you use as it doesn't contains to $values variable.
Anyway, the best approach is to set 'View as' type of one of fields to 'Csutom'.

More info:

http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm

D
darcik author 1/9/2011

Tnx for your answer. So suppose that there is no access to these variables.

I know your solution, but it has some drawbacks. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=55481&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />

This View as, working at all pages as List, Edit, etc

At List page I dont need all information about customer as adress, phone number, etc, but only eg. client name.

I need all information only on printing page.
In DB: Table_customer have fields: ID, name, adress, phone_number.

Table_invoice have fields: ID, customer_id, .....

For Table_invoice at Edit, Add, List pages I'll only show Field name. At Add/Edit/List pages Im using Lookup table with ID from Table_customer, displayed data from field: name

At Printer-friendly page I want other data from Table_customer.

Is this possible?

At Printer-friendly page read customer_id and make SQL-query for retrieve needed data and view this?
Best Regards

Sergey Kornilov admin 1/10/2011

Add field alias to SQL query. Example:

select

name,

name as name1,

...



Now you can setup different 'View as' formats for Name and for Name1. Make Name appear on all pages except Printer-friendly, make Name1 appear on Printer-friendly page only.

D
darcik author 1/11/2011



Add field alias to SQL query. Example:

select

name,

name as name1,

...



Now you can setup different 'View as' formats for Name and for Name1. Make Name appear on all pages except Printer-friendly, make Name1 appear on Printer-friendly page only.


Big thanks for this solutions. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=55520&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />