Note that there are some explanatory texts on larger screens.

plurals
  1. PONested IF statement PHP
    primarykey
    data
    text
    <p>after a bit of adivce -I have a rather lengthy chunk of nested if statement, and I'm looking at ways I can refine it and make it more efficient. I did think of a switch - but I can't see how I could split this up.</p> <p>Any thoughts appreciated</p> <pre><code> $portfolioItems [$i] = array(//assign vars into array 'imagePath' =&gt; '/sites/jda_redev/'.$myrow_home-&gt;path.'/thumbs/thumbs_'.$myrow_home-&gt;filename, 'altText' =&gt; $myrow_home-&gt;alttext, 'description' =&gt; $myrow_home-&gt;description, 'client' =&gt; $extra_client-&gt;field_value, 'job' =&gt; $extra_job-&gt;field_value, 'channel' =&gt; $extra_channel-&gt;field_value, 'channeltwo' =&gt; $extra_channeltwo-&gt;field_value, 'channelthree' =&gt; $extra_channelthree-&gt;field_value, 'channelfour' =&gt; $extra_channelfour-&gt;field_value, 'channelfive' =&gt; $extra_channelfive-&gt;field_value, 'sector' =&gt; $extra_sector-&gt;field_value, 'workerone' =&gt; $extra_workerone-&gt;field_value, 'workertwo' =&gt; $extra_workertwo-&gt;field_value, 'gallery' =&gt; $galleryName, 'mediaType' =&gt; $media_type-&gt;field_value, 'videoName' =&gt; $video_name-&gt;field_value ); if ( $portfolioItems [$i]['imagePath'] == "" ) {$portfolioItems [$i]['imagePath'] = " ";} if ( $portfolioItems [$i]['altText'] == "" ) {$portfolioItems [$i]['altText'] = " ";} if ( $portfolioItems [$i]['description'] == "" ) {$portfolioItems [$i]['description'] = " ";} if ( $portfolioItems [$i]['client'] == "" ) {$portfolioItems [$i]['client'] = " ";} if ( $portfolioItems [$i]['job'] == "" ) {$portfolioItems [$i]['job'] = " ";} if ( $portfolioItems [$i]['channel'] == "" ) {$portfolioItems [$i]['channel'] = " ";} if ( $portfolioItems [$i]['channeltwo'] == "" ) {$portfolioItems [$i]['channeltwo'] = " ";} if ( $portfolioItems [$i]['channelthree'] == "" ) {$portfolioItems [$i]['channelthree'] = " ";} if ( $portfolioItems [$i]['channelfour'] == "" ) {$portfolioItems [$i]['channelfour'] = " ";} if ( $portfolioItems [$i]['channelfive'] == "" ) {$portfolioItems [$i]['channelfive'] = " ";} if ( $portfolioItems [$i]['sector'] == "" ) {$portfolioItems [$i]['sector'] = " ";} if ( $portfolioItems [$i]['workerone'] == "" ) {$portfolioItems [$i]['workerone'] = " ";} if ( $portfolioItems [$i]['workertwo'] == "" ) {$portfolioItems [$i]['workertwo'] = " ";} if ( $portfolioItems [$i]['gallery'] == "" ) {$portfolioItems [$i]['gallery'] = " ";} if ( $portfolioItems [$i]['mediaType'] == "" ) {$portfolioItems [$i]['mediaType'] = " ";} if ( $portfolioItems [$i]['videoName'] == "" ) {$portfolioItems [$i]['videoName'] = " ";} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload