This topic is locked

LIST PAGE - record with a subquery

11/20/2007 3:01:32 AM
PHPRunner General questions
M
Martijn author

Hello,
I have a problem how to show a subquerylist in a field on the list page.
This is an example so you understand what I mean:

2 tables: car and type
list page:
now:

id | brand | description | type

1 VW Golf B

1 VW Golf C
what I want:

id | brand | description | type

1 VW Golf B,C
I hope this possible within phprunner .
tnx in advanced

Martijn

M
Martijn author 11/20/2007

After a big search I found the option: "Insert php code snippet"

I think I can fix my problems if somebody can help me how to get the record_id in this event <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23477&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />
function cars_types(&$params)

{
//need the recordid for my sql
}
tnx in advanced

J
Jane 11/20/2007

Martijn,
you can set up type field as Custom on the "View as" settings dialog.

Here is a sample:

global $data,$conn;

$str = "";

$str = "select type from TableName where ID=".$data["ID"];

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

while ($datatmp = db_fetch_array($rs))

$str.=$datatmp["type"].",";

$str = substr($str,0,strlen($str)-2);

$value = $str;