[SOLVED] Create dynamic link id from while loop

I have a script where I need to create a dynamic id from each record retrieved from mysql. At the moment I am using the <a> tag for testing using # in href and would be happy if this could achieved using links.

The other problem is once these id’s are created I need to be able to select them from jquery click event and the result placed in #div2. I have posted code for php and would be grateful if someone could help.

Assume this code working as is. Many thanks

<div style="width: 33%; height: auto; float:left;">
    <?php
    $inboxnum_rows = mysqli_num_rows($inboxresult);
    if(!$inboxnum_rows) {
    echo 'No reults to display';
    } else {
    while ($inboxrow = mysqli_fetch_assoc($inboxresult)) {
    $date = $inboxrow["date_frm"];
    $date = strtotime( $date );
    $date = date( 'd/m/Y H:i:s', $date );
    $from = $inboxrow["from_frm"];
    $subject = $inboxrow["subject_frm"];
    echo '<div style="margin-right: 6px; margin-bottom: 10px; padding: 7px; border: 1px solid #ccc; height: auto;">';
    echo '<span style="font-weight: bold;">' . $from . '</span>';
    echo '<br />';
    echo "<a href='#'>" .$subject. "</a>" . '<span style="float: right;">' .$date. '</span>';
    echo '</div>';
    }
    }
    ?>
</div>
<div id="div2" style="width: 65%; height: auto; padding: 8px; border: 1px solid #ccc; float:left;">
    No new mail selected or to display
</div>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.