Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8150419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:03:42+00:00 2026-06-06T15:03:42+00:00

I need to store different table markup code in a php array, as a

  • 0

I need to store different table markup code in a php array, as a string. Some of the code that needs to be stored in an array needs to be tested using an if-statement. Before I knew I needed some of the code needs to be tested in such a way, everything was working flawlessly, but now that I know that the string stored is based on an ‘if-statement’ I am not sure how to code it. Because I need to end the markup for the current slot in order to insert the php conditional statement. As a result, I am unable to continue storing data in the ‘current’ slot, which is what I need.

I have been trying to find work arounds for over an hour now, I appreciate any help with this.

$favorites[] = '
        <tr>
          <td><a href="#">'.$files_row['name'].'</a></td>
          <td><a href="#"><img class="table-button" src="images/smallglobe.png"></a></td>
          <td>
            <img src="images/e-mail-icon.PNG">';
                if(strcmp($_files_row['email'],'none') != 0){
                    $favorites[] = '<div style="display:none;"><a href="#" >'.$files_row['email'].'</a></div>';
                }
$favorites[]='        
         </td>
          <td class="table-button-cell">
            <img class="table-button" src="images/eicon.png">
            <div class="phonepopup" style="display:none;">Call: '.$files_row['phone'].'</div>
          </td>
          <td class="table-button-cell"> .... etc....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:03:43+00:00Added an answer on June 6, 2026 at 3:03 pm

    try to use a temporary variable for the current slot and assign it to the array, after the if-statements have been evaluated. so you can concatenate the necessary strings:

    $temp_var = '
        <tr>
          <td><a href="#">'.$files_row['name'].'</a></td>
          <td><a href="#"><img class="table-button" src="images/smallglobe.png"></a></td>
          <td>
            <img src="images/e-mail-icon.PNG">';
                if(strcmp($_files_row['email'],'none') != 0){
                    $temp_var .= '<div style="display:none;"><a href="#" >'.$files_row['email'].'</a></div>';
                }
    $temp_var .='        
         </td>
          <td class="table-button-cell">
            <img class="table-button" src="images/eicon.png">
            <div class="phonepopup" style="display:none;">Call: '.$files_row['phone'].'</div>
          </td>
          <td class="table-button-cell"> .... etc....';
    
    $favorites[] = $temp_var;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a simple markup language to store different parts of a string on
So long story short, i have some forms (2) of them that, need different
I need to store reviews from different sources in table. Fields: 'produtcId' char(14) 'user'
I need to create a database table to store different changelog/auditing (when something was
I have a table in which I need to store some serialized json strings
I am doing a project (PHP) where i need to store about 4 different
We need to store a list of data we pull from another table that
I need to create a table in MySQL which stores the different currency symbols
I need to store different versions of not very long strings for different languages
I need to read different values stored in a file one by one. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.