This topic is locked

dropdown box multiline

4/20/2012 1:58:05 AM
PHPRunner General questions
C
ckapote author

Hi
i have a dropdown box multiline that looks up to one other table selecting multiply entries and store it .
When it stores the id of the lookup table it shows the id numbers instead the text field which i want to show .
how can i fix that in list/view page
i know that when you select multiply entries in dropdown boxes it works like that but i need to store the id and list/view the text field of one other field or related table
thanks

W
wildwally 4/25/2012



Hi
i have a dropdown box multiline that looks up to one other table selecting multiply entries and store it .
When it stores the id of the lookup table it shows the id numbers instead the text field which i want to show .
how can i fix that in list/view page
i know that when you select multiply entries in dropdown boxes it works like that but i need to store the id and list/view the text field of one other field or related table
thanks


I was able to accomplish what you are asking by doing the following:

In the editor view as set to custom and use a custom query silimar to this. This is MS SQL:


global $conn;

$Subrec = "DECLARE @theList VARCHAR(2000)

SET @theList =''



SELECT @TheList=@theList+[fieldnameintable]+','

FROM tablename WHERE Id in (."data["nameoffield'].")



IF @@rowcount > 0

SET @TheList=left(@TheList,len(@TheList)-1)



select @theList as list";

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

$data1 = db_fetch_array($rs);
$value = $data1['list'];