Forum Moderators: coopster
$pidcheck = mysql_query("SELECT * FROM phpbb_posts_text
WHERE post_id='$pid'");
$tdcount = 1;
$numtd = 3; // number of cells per row
?>
<table border="0">
<?php
while ($row = mysql_fetch_array ($pidcheck))
{
$text = $row['short_desc'];
$text = stripslashes($text);
$subject = $row['post_subject'];
if ($tdcount == 1)
echo "<tr>";
?>
<td>
<?php
echo "<b><a href='videos.php?view=" . $topicid . "'></b><p>
<img src='images/videoimgs/" . $topicid . ".png' border='0' height='60px' width='60px' align='left'/><span class='genbig'>
" . $subject . "</a></span><br><span class='gensmall'>" . $text;
echo "</p></span><br><center>___________</center><br>"; // display as you like
?>
</td>
<?php
if ($tdcount == $numtd)
{
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
}
}// time to close up our table
if ($tdcount!= 1)
{
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++; } echo "</tr>";
}
?>
</table>
while($row = mysql_fetch_array($fidcheck))
{
$pid = $row['post_id'];
$posterid = $row['poster_id'];
$topicid = $row['topic_id'];
$first = mysql_query("SELECT * FROM phpbb_topics
WHERE topic_first_post_id='$pid'");
$vidnum = mysql_num_rows($first);
while($row = mysql_fetch_array($first))
{
$pid = $row['topic_first_post_id'];
$posterid = $row['topic_poster'];
$topicid = $row['topic_id'];
$getname = mysql_query("SELECT * FROM phpbb_users
WHERE user_id='$posterid'");
while($row = mysql_fetch_array($getname))
{
$author = $row['username'];
$authorid = $row['user_id'];
}
$pidcheck = mysql_query("SELECT * FROM phpbb_posts_text
WHERE post_id='$pid'");
$tdcount = 1;
$numtd = 3; // number of cells per row
?>
<table border="0">
<?php
while ($row = mysql_fetch_array ($pidcheck))
{
$text = $row['short_desc'];
$text = stripslashes($text);
$subject = $row['post_subject'];
if ($tdcount == 1)
echo "<tr>";
?>
<td>
<?php
echo "<b><a href='videos.php?view=" . $topicid . "'></b><p>
<img src='images/videoimgs/" . $topicid . ".png' border='0' height='60px' width='60px' align='left'/><span class='genbig'>
" . $subject . "</a></span><br><span class='gensmall'>" . $text;
echo "</p></span><br><center>___________</center><br>"; // display as you like
?>
</td>
<?php
if ($tdcount == $numtd)
{
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
}
}// time to close up our table
if ($tdcount!= 1)
{
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++; } echo "</tr>";
}
?>
</table>
while($row = mysql_fetch_array($fidcheck))
. . .
while($row = mysql_fetch_array($first))
. . .
<added>
There is a third one also:
while($row = mysql_fetch_array($getname))
. . .
The $row variable needs to be different in all the cases.
[edited by: Habtom at 10:20 am (utc) on Dec. 2, 2007]
$fidcheck = mysql_query("SELECT * FROM phpbb_posts
WHERE forum_id='2' ORDER BY `post_id` DESC LIMIT 36");while($row1 = mysql_fetch_array($fidcheck))
{
$pid = $row1['post_id'];
$posterid = $row1['poster_id'];
$topicid = $row1['topic_id'];
$first = mysql_query("SELECT * FROM phpbb_topics
WHERE topic_first_post_id='$pid'");
$vidnum = mysql_num_rows($first);
while($row2 = mysql_fetch_array($first))
{
$pid = $row2['topic_first_post_id'];
$posterid = $row2['topic_poster'];
$topicid = $row2['topic_id'];
$getname = mysql_query("SELECT * FROM phpbb_users
WHERE user_id='$posterid'");
while($row3 = mysql_fetch_array($getname))
{
$author = $row3['username'];
$authorid = $row3['user_id'];
}
$pidcheck = mysql_query("SELECT * FROM phpbb_posts_text
WHERE post_id='$pid'");
$tdcount = 1;
$numtd = 3; // number of cells per row
?>
<table border="0">
<?php
while ($row = mysql_fetch_array ($pidcheck))
{
$text = $row['short_desc'];
$text = stripslashes($text);
$subject = $row['post_subject'];
if ($tdcount == 1)
echo "<tr>";
?>
<td>
<?php
echo "<b><a href='videos.php?view=" . $topicid . "'></b><p>
<img src='images/videoimgs/" . $topicid . ".png' border='0' height='60px' width='60px' align='left'/><span class='genbig'>
" . $subject . "</a></span><br><span class='gensmall'>" . $text;
echo "</p></span><br><center>___________</center><br>"; // display as you like
?>
</td>
<?php
if ($tdcount == $numtd)
{
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
}
}// time to close up our table
if ($tdcount!= 1)
{
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++; } echo "</tr>";
}
?>
</table>
> See the the the html source, and check if you are really getting <tr><td></td></tr> or the opening and closing tags are messed. That might give you some hint, and the output on the screen might not show you what kind of code structure you have on the source. So, check the source.
> If it is generating the <tr><td></td></tr> opening and closing it properly, but displaying only one td in a tr: Though I know the increment is supposed to work that way, try changing it to: $tdcount = $tdcount + 1;
> if ($tdcount == 1) echo "<tr>";
if ($tdcount == 1) { echo "<tr>"; }
Let's narrow down the possible reasons, but the code in general seems ok with me.
<table border="0">
<tr><td>
[ENTERS ONE HERE]</td>
<table border="0">
<tr><td>[ENTERS ONE HERE]</td>
<table border="0">
<tr><td>[ENTERS ONE HERE]</td>
<table border="0">
<tr><td>[ENTERS ONE HERE]</td>
<td>[PUTS SPACE HERE]</td><td>[PUTS SPACE HERE]</td></tr></table></td>
</tr>
</table>
[edited by: GamingLoft at 11:04 am (utc) on Dec. 2, 2007]