Jump to content

Several Tables


Recommended Posts

On the same page I have several Table\Db tables. I need to know the count of rows in each one in the template I am showing "all" of them in. What is a good way of going about this, without wasting a duplicate query that would already be used in getRows()? (actually I don't need to know the exact count, I just need to know yes or no does it have at least 1 row in it)

If it were just one table, easy.... in that one table's template check count( $rows ). But when each table has its own template and I need to know the counts in the master template... I'm drawing a blank.

What I had been doing is checking if( trim( $table ) ) for each table in the template, but that doesn't work because it always returns TRUE because a table with no rows var_dumps as something like a 50 character "empty" string. In other words, the var dump says it has that many characters to it, but then for the value it shows "". I guess because it had been run through a template which returned "". (so even though the template retuened "", the variable is the template info with an empty string as the html in that template).

At this point all I can think of is overwriting methods, but even then... I mean once the table is in that final template it's just the html, not the table object anymore... so I can't just check it in $table.

(ps... I'm finally almost out of questions. lol. A ton of areas in my code worked as intended right off (I sometimes do a ton of functions before testing any of them...), so I;'m almost done).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...