mysql_data_seek is returning an Extra Empty row

Hello,

I am using mysql_data_seek to do multiple loops, the problem is that it is returning an extra blank row....

so the first time it loops, i get 3 results, after i use mysql_data_seek and loop again I get 4 results with the first being empty, this is the code...
$query_Recordset_get_menu_java_cat = "SELECT * FROM product_cat ORDER BY product_cat_name ASC";
$Recordset_get_menu_java_cat = mysql_query($query_Recordset_get_menu_java_cat, $mine) or die(mysql_error());
$row_Recordset_get_menu_java_cat = mysql_fetch_assoc($Recordset_get_menu_java_cat);
$totalRows_Recordset_get_menu_java_cat = mysql_num_rows($Recordset_get_menu_java_cat);


<?php do { // this gets 3 results - perfect  ?>

Product Cat DIV <?php echo $row_Recordset_get_menu_java_cat['product_cat_id']; ?>


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



<?php 
mysql_data_seek($Recordset_get_menu_java_cat, 0);
do { // this gets 4 results - 1st one empty ?>

Product Cat DIV <?php echo $row_Recordset_get_menu_java_cat['product_cat_id']; ?>


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

Open in new window

LVL 1
jblayneyAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
please change your loops into:


<?php
//mysql_data_seek($Recordset_get_menu_java_cat, 0);
while ($row_Recordset_get_menu_java_cat = mysql_fetch_assoc($Recordset_get_menu_java_cat))
{  ?>

Product Cat DIV <?php echo $row_Recordset_get_menu_java_cat['product_cat_id']; ?>

<?php  }  ?>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.