I have to generate a HTML table from two MySQL db tables.
It has to display all of the items available to the user.

But one column in the display table has to do with the
users history with a particular row. Either he has
some kind of history, or he has none.

So...
I have 4 rows total in the item control dbtable.
I always have to display the total amount of rows in the
item control table (4 at this time).
items.it_ID
items.it_Name
etc...

Yet my user has a history with only 1 of the items and
this data is kept in the user_item_history dbtable.
user_item_history.ID
items.it_ID
user.UserID
etc....

So my HTML output would have to look like...

ITEM TITLEUSER ITEM HISTORY
---------------------------
Item OneNo User History
Item TwoClick for History
Item ThreeNo User History
Item FourNo User History

It would be easy if I only had to show the items
related to, or not to the user. But I need to show both.

I'm looking at 2 different queries, array's and while loops.
I've tried a number of different things but none seem
to do what I want.

I'm stuck.

Thanks,
The Stuck Newbie


In reply to Newbie can't see the forest by CrossEyedMonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.