0

I try to get a result from the same MySQL more than once, so I am using mysql_data_seek but the result always add one empty row at the first data

Here is my code :

<?php mysql_data_seek($Recordset1,0);?>
            data: [

            <?php do { ?>

      <?php echo $row_Recordset1['kbo1'].","; ?>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
            ]

THERE IS ONE EMPTY ROW, IN THE BEGINNING, CHECK THE SCREENSHOT:

enter image description here

i dont know if i put the mysql_data_seek at the right place or there is another way to using mysql_data_seek

1
  • 2
    WARNING! This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used Commented Feb 25, 2019 at 7:34

1 Answer 1

1

It's because you're outputting a value before you read from the table. Try changing to a while loop instead:

<?php mysql_data_seek($Recordset1,0);?>
        data: [
<?php while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)) {
           echo $row_Recordset1['kbo1'].","; ?>
      } ?>
        ]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.