I have this code
I have looked at it for hours and cannot figure out why it does not work. If I use the for/each loop, the loop is true and it produces the table showing the same record 10 times. This is because I have one record with five fields (and I guess that phpMyAdmin adds a blank record) plus a blank record thus 10 is the number of fields in all records combined.
Just above this, I have code where I open a different mySQL table from same database. The idea is to put in a variable ($CommRowTable) a table/rows/columns formatting data extracted from mySQL table. The variable will then be printed like so
You see, for each entry, there might be any number of comments attached to it (same as here when a thread is created).
This link may give you an idea of what I am working on
Thank you all for your assistance!
Jose Lerebours
KNOWLEDGE: Something you can give away endlessly and gain more of it in the process! - Jose Lerebours
Code:
$CommRowTable = "";
$CommQuery = 'select * FROM `snipscomments` WHERE `snipscomments`.`snipID` = ' . $_GET['Code'];
$CommData = mysql_query ($CommQuery);
$CommRow = mysql_fetch_array($CommData);
if (sizeof($CommRow) > 0) {
$CommRowTable = '<table border="1" cellpadding="0" cellspacing="0">';
// for ($i = 0; $i < sizeof($CommRow); $i++) {
while ($crow = mysql_fetch_array($CommData)) {
$aSnipComment = explode("<br />",nl2br($crow['snipComment']));
$vSnipComment = Array2String($aSnipComment);
$CommRowTable = $CommRowTable . '
<tr><td bgcolor="#CCCCCC"><span style="float: left;">Posted By: ' . $crow['snipCommBy'] . '</span> <span style="float: right;">On: ' . $crow['snipCommDate'] . '</span></td></tr>
<tr><td>' . $vSnipComment . '</td></tr>
';
} // Close while loop
$CommRowTable = $CommRowTable . '</table>';
} else {
$CommRowTable = '<table border="0" cellapdding="0" cellspacing="0"><tr><td>No Comments Posted!</td></tr></table>';
} // Close if sizeof()
I have looked at it for hours and cannot figure out why it does not work. If I use the for/each loop, the loop is true and it produces the table showing the same record 10 times. This is because I have one record with five fields (and I guess that phpMyAdmin adds a blank record) plus a blank record thus 10 is the number of fields in all records combined.
Just above this, I have code where I open a different mySQL table from same database. The idea is to put in a variable ($CommRowTable) a table/rows/columns formatting data extracted from mySQL table. The variable will then be printed like so
Code:
echo '
<table name="tabTable" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<div class="tabber">
<div class="tabbertab">
<h2>General</h2>
<p>
<table name="tabGeneral">
<tr>
<td>Posted By</td>
<td>' . $vAuthor . '</td>
</tr>
<tr>
<td>Posted Date</td>
<td>' . $vSince . '<td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">' . $vSubject . '</td>
</tr>
</table></p>
</div>
<div class="tabbertab">
<h2>Description</h2>
<p>' . $vDesc . '</p>
</div>
<div class="tabbertab">
<h2>The Code</h2>
<p>' . $vCode . '</p>
</div>
<div class="tabbertab">
<h2>Comments</h2>
<p>' . $CommRowTable . '</p>
</div>
</div>
</tr></td>
';
You see, for each entry, there might be any number of comments attached to it (same as here when a thread is created).
This link may give you an idea of what I am working on
Code:
[URL unfurl="true"]http://www.fpgroups.com/index.php?Target=code&Action=read&Code=1[/URL]
Thank you all for your assistance!
Jose Lerebours
KNOWLEDGE: Something you can give away endlessly and gain more of it in the process! - Jose Lerebours