Solved

can not loop through mysql object notation

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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 …

746 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