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 9119189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:20:11+00:00 2026-06-17T05:20:11+00:00

$rows = getChallengeList(); error_log(print_r($rows, 1)); ?> <table border=1> <tr><th>ID</th><th>Title</th><th>Description</th></tr> <?php foreach ($rows as $row):

  • 0
$rows = getChallengeList();
error_log(print_r($rows, 1));
?>
<table border="1">
    <tr><th>ID</th><th>Title</th><th>Description</th></tr>
    <?php foreach ($rows as $row): ?>
        <?php foreach($row as $chal): ?>
        <tr>
            <td><?= $chal['loyalty_challenges_id']; ?></td>
            <td><?= $chal['title']; ?></td>
            <td><?= $chal['description']; ?></td>
        </tr>    
        <?php endforeach; ?>
    <?php endforeach; ?>
</table>

The error_log returns this:

[11-Jan-2013 10:44:27] Array
(
    [0] => Array
        (
            [loyalty_challenges_id] => 1
            [title] => New Customer Special
            [description] => Reward new customers with a free order of breadsticks after placing their second order during their first 30 days 
        )

    [1] => Array
        (
            [loyalty_challenges_id] => 2
            [title] => Frequent Flyer Special
            [description] => Reward long-time customers who order often with a free pizza
        )

)

But the values rendered by the loop look like this:

<table border="1">
    <tr><th>ID</th><th>Title</th><th>Description</th></tr>
    <tr>
        <td>1</td>
        <td>1</td>
        <td>1</td>
    </tr>    
    <tr>
        <td>N</td>
        <td>N</td>
        <td>N</td>
    </tr>    
    <tr>
        <td>R</td>
        <td>R</td>
        <td>R</td>
    </tr>    
    <tr>
        <td>2</td>
        <td>2</td>
        <td>2</td>
    </tr>    
    <tr>
        <td>F</td>
        <td>F</td>
        <td>F</td>
    </tr>    
    <tr>
        <td>R</td>
        <td>R</td>
        <td>R</td>
    </tr>    
</table>

Any idea what would cause that? It’s been a while since I’ve worked with straight php, rather than CMS’s that have their own array processing functions.

  • 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-17T05:20:13+00:00Added an answer on June 17, 2026 at 5:20 am

    You have one loop too much:

    $rows = getChallengeList();
    error_log(print_r($rows, 1));
    ?>
    <table border="1">
        <tr><th>ID</th><th>Title</th><th>Description</th></tr>
        <?php foreach ($rows as $chal): ?>
            <tr>
                <td><?= $chal['loyalty_challenges_id']; ?></td>
                <td><?= $chal['title']; ?></td>
                <td><?= $chal['description']; ?></td>
            </tr>    
        <?php endforeach; ?>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

table.rows.length in Java script returns the count of rows in the table including rows
I'm adding data rows to my data table but the row count in the
A function should select rows in a table based on the row name (column
tryng to select table rows and then use subqueries to generate single row list
How to select table rows excluding first row. Number of table rows could vary.
I'm generating table rows N times. If the user clicks add row buttons, I'm
DataTable.Rows.Add() adds a row to the data table. However, how does it handle the
All rows in a table have a type field which is either 0 or
I need to delete rows in a table, such as DELETE FROM TABLE_X WHERE
I should add rows to the table with jQuery: <table class=table> <tbody id=dh-values> </tbody>

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.