Solved

can not loop through mysql object notation

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

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…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

810 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