• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

can not loop through mysql object notation

$arr_client_me = array('client','me');
   foreach($arr_client_me as &$column_name){    
      if(empty($row->$column_name.'_start')){

want:
      if(empty($row->client_start)){
      if(empty($row->me_start)){


this works:
  if(empty($row[$column_name.'_start'])){
0
rgb192
Asked:
rgb192
1 Solution
 
Slick812Commented:
there may be some mixup for PHP in finding what the "String" is you want to use after the  ->
you might try -
foreach($arr_client_me as $column_name){
    $column_name .= '_start';
      if(empty($row->$column_name)){


OR -
foreach($arr_client_me as $column_name){    
      if(empty($row->{$column_name.'_start'})){
0
 
rgb192Author Commented:
thanks
I used  if(empty($row->{$column_name.'_start'})){
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now