php - Return values for appropriate arguments -


is here possible write single return both $strvalues , $strthumbimages need return $strvalues every time returning $strthumbimages when available..

 function doselectbranchrecords($objarray,$imageid = null)         {             global $global_config;             $strwhereclause = '';             if ($objarray['frmnamesearch']) {                 $strwhereclause.= " , a.branch_ident = '".$objarray['frmnamesearch']."' ";             }             if ($objarray['frmloansearch']) {                 $strwhereclause.= " , a.loan_ident = '".$objarray['frmloansearch']."' ";             }             if ($objarray['frmbeneficiarysearch']) {                 $strwhereclause.= " , a.beneficiary_idents = '".$objarray['frmbeneficiarysearch']."' ";             }             if ($objarray['frmdatesearch']) {                  $strdate = explode("-", $objarray['frmdatesearch']);                 $straccountstarted = $strdate[2].'-'.$strdate[1].'-'.$strdate[0];                  $strwhereclause.= " , a.account_started = '".$straccountstarted."' ";                 /*printarray($strwhereclause); exit;*/             }              if ($imageid) {                  $strthumbimages = $global_config["siteglobaluploadpath"].$imageid;                 return $strthumbimages;             }               $strsqlselect = "select a.*,b.branch_name tbl_companydetails a,tbl_branchdetails b a.branch_ident=b.branch_id $strwhereclause order company_id desc";             $strvalues = selectqry($strsqlselect);             return $strvalues;          } 

@simon , @suchit right in cannot return more 1 variable. in php straightforwarded return list multiple items so:

function getxyz(){   return array(4,5,6); }  list($x,$y,$z) = getxyz(); 

so in case so:

$strthumbimages  = null; if ($imageid) {   $strthumbimages = $global_config["siteglobaluploadpath"].$imageid; } $strsqlselect = "select a.*,b.branch_name tbl_companydetails a,tbl_branchdetails b     a.branch_ident=b.branch_id $strwhereclause order company_id desc"; $strvalues = selectqry($strsqlselect); return array($strvalues, $strthumbimages); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -