Question

I'm copying a vtiger query in a similar way but there is one change that the query given first having only one output so there is kept 0 in 2nd argument, but in my customized query there are multiple outputs so what should I kept instead of 0 both are given as below:

  1. original query

$is_recurring_event_query = $adb->pquery('SELECT recurring_group_id from vtiger_activity where activityid=?',array($id));

$is_recurring_event = $adb->query_result($is_recurring_event_query,0,'recurring_group_id');

  1. copying it to use at different way

$is_recurring_event_activity_query = $adb->pquery('SELECT activityid from vtiger_activity where recurring_group_id='.$is_recurring_event);

$is_recurring_event_activity = $adb->query_result ($is_recurring_event_activity_query,0,'activityid');

Was it helpful?

Solution

You have to put variable and have to use for loop for your query to execute and get multiple values.

Suppose your query is like this

$result = $adb->pquery ('SELECT * from vtiger_activity where id='.$recordId);
$noofrow = $adb->num_rows($result );
for($i=0; $i<$noofrow ; $i++) {
            $Data['activityid']=$adb->query_result($result,$i,'activityid');
            $Data['activityname']=$adb->query_result($result,$i,'activityname');
}

Here in $Data you will get an array of the values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top