Solved

can not loop through mysql object notation

Posted on 2013-05-23
2
170 Views
Last Modified: 2013-05-24
$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
Comment
Question by:rgb192
2 Comments
 
LVL 33

Accepted Solution

by:
Slick812 earned 500 total points
ID: 39191938
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
 

Author Closing Comment

by:rgb192
ID: 39194620
thanks
I used  if(empty($row->{$column_name.'_start'})){
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now