Skip navigation
Currently Being Moderated

Weird data repeater problem

Mar 5, 2012 8:47 AM

Hi All. I'm in the middle of moving from being a dreamweaver only developer to being more of a hand coding kind of level of app development, and I'm running into a weird problem. Let me explain as best i can :

 

I have an SQL recordset that returns exactly 3 rows of data (i checked and it's fine)

 

I am attempting to use php to create the html markup dynamically for some fancy popup boxes, one for each record

 

using a basic incremented variable, i have attempted to make it create the three divs and using the incremented value, give the divs an id of "sticky1", "sticky2" and "sticky3", and just to check it works, put the value of the field "serialnumber" in the table row as well

 

the weird result i get is that the first row, the div and table inside it is generated, but without the serialnumber being echoed. The second row works fine and shows the right serial number; and the last row doesn't generate a thing.

 

From past experiences in other languages, i suspect it's not ticking over to the next record as i'm expecting it to do, i'm just hoping someone can spot the error and tell me what I'm missing.

 

Just so you don't waste time worrying about stuff i've already checked :  the database is indeed returning the right data, three rows. Checked it several times to be sure. Here is my code. It's just skeleton code to make it simple, and get it working.

 

 

<?php

 

$aa = 1 ;     

 

do {

 

$thename2 = "sticky".$aa;

$aa= $aa+1;

?>  

 

<div id="<?php echo $thename2 ?>" class="atip"  style="width:262px">

<table width="300" border="0">

  <tr>

    <td width="82"><?php echo $thename2 ?></td>

    <td width="208"><?php echo htmlentities($tooltipCreate['serialnumber'], ENT_COMPAT, 'UTF-8'); ?></td>

  </tr>

</table>

</div>

 

<?php } while ($tooltipCreate = mysql_fetch_assoc($tooltipCreate)); ?>

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points