Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

can not loop through mysql object notation

Posted on 2013-05-23
2
172 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 34

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

860 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