Repeat region making my dynamic text not render!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Idledaylight
Forum Newbie
Posts: 5
Joined: Wed May 19, 2004 1:18 pm

Repeat region making my dynamic text not render!

Post by Idledaylight »

Hi, through trial and error, I discovered that the following code

Code: Select all

<?php do { ?>
	<table width="259" height="36" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="90" rowspan="2"><img src="images/products/comingsoon.gif" width="90" height="90"></td>
          <td height="24" align="left" class="headerwhite"><img src="../Images/blank.gif" width="10" height="10"><?php echo $row_rsGetInfo['prodName']; ?></td>
        </tr>
        <tr>
          <td height="12" align="left"><p><strong><img src="../Images/blank.gif" width="10" height="50" align="left">Our Price</strong>:<?php echo DoFormatCurrency($row_rsGetInfo['prodPrice'], 2, '.', ',', '$'); ?> <br>
          <strong>Rental Period</strong>: 1 Day </p></td>
        </tr>
        </table>
		<br>
	<?php } while ($row_rsGetInfo = mysql_fetch_assoc($rsGetInfo)); ?>
is preventing this statement from rendering:

Code: Select all

<?php echo $row_rsGetInfo['subCatName']; ?>
If I place the second block before the repeat region, it displays fine, or even within it will work...but anywhere after, the php simply won't output it.

Thanks in advance for your time and help!

Josh
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Re: Repeat region making my dynamic text not render!

Post by feyd »

try

Code: Select all

<?php while ($row_rsGetInfo = mysql_fetch_assoc($rsGetInfo)) { ?>
	<table width="259" height="36" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="90" rowspan="2"><img src="images/products/comingsoon.gif" width="90" height="90"></td>
          <td height="24" align="left" class="headerwhite"><img src="../Images/blank.gif" width="10" height="10"><?php echo $row_rsGetInfo['prodName']; ?></td>
        </tr>
        <tr>
          <td height="12" align="left"><p><strong><img src="../Images/blank.gif" width="10" height="50" align="left">Our Price</strong>:<?php echo DoFormatCurrency($row_rsGetInfo['prodPrice'], 2, '.', ',', '$'); ?> <br>
          <strong>Rental Period</strong>: 1 Day </p></td>
        </tr>
        </table>
		<br>
	<?php } ?>
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

The first tr also has 2 td's, so the 2nd tr should probably use a <td colspan="2" as it only has one td :o
Idledaylight
Forum Newbie
Posts: 5
Joined: Wed May 19, 2004 1:18 pm

Post by Idledaylight »

Thanks for the responses!

The HTML is correct. Its a rowspan not a colspan.

I tried switching the do while loop for a while loop and the problem is still there. The php simply wont output that particular string. I've played around more and

Code: Select all

<?php echo 'test' ?>
will output just fine but not

Code: Select all

<?php echo $row_rsGetInfo['subCatName']; ?>
Any help would be appreciated!
Idledaylight
Forum Newbie
Posts: 5
Joined: Wed May 19, 2004 1:18 pm

Post by Idledaylight »

Lol, I THINK I fixed it. Let me know if this makes sense. It works. But if its not correct than its not good enough.

the following loop:

Code: Select all

<?php do { ?>
	<table width="259" height="36" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="90" rowspan="2"><img src="images/products/comingsoon.gif" width="90" height="90"></td>
          <td height="24" align="left" class="headerwhite"><img src="../Images/blank.gif" width="10" height="10"><?php echo $row_rsGetInfo['prodName']; ?></td>
        </tr>
        <tr>
          <td height="12" align="left"><p><strong><img src="../Images/blank.gif" width="10" height="50" align="left">Our Price</strong>:<?php echo DoFormatCurrency($row_rsGetInfo['prodPrice'], 2, '.', ',', '$'); ?> <br>
          <strong>Rental Period</strong>: 1 Day </p></td>
        </tr>
      </table>
		<br>
	<?php } while ($row_rsGetInfo = mysql_fetch_assoc($rsGetInfo)); ?>
uses the variable $row_rsGetInfo to determine when to end the loop according to how many records there are. Is this just a counter? It seems like it is to me, so I replaced it with $recordCounter and it worked just fine and doesn't screw with the other dynamic text I was trying to output.

Let me know if this just somehow happens to be working now or if it looks good. I'm very new to dynamic web sites.

Thanks,

Josh
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

seems a bit odd.. what's the code leading up to this?
Post Reply