Skip to main content
August 1, 2009
Question

Get exact row from database table

  • August 1, 2009
  • 5 replies
  • 952 views

This is part of my source code that displays one row from getQuest recordset. Always first.

<body>

<p><?php echo $row_getQuest['content']; ?></p>
<p>: <?php echo $row_getQuest['prom1']; ?></p>
<p><?php echo $row_getQuest['prom2']; ?></p>
<?php echo $row_getQuest['dos1']; ?>(); <?php echo $row_getQuest['dos2']; ?> (); <?php echo $row_getQuest['dos3']; ?> (); <?php echo $row_getQuest['dos4']; ?>(); <?php echo $row_getQuest['dos5']; ?> (); <?php echo $row_getQuest['dos6']; ?> (); <?php echo $row_getQuest['dos7']; ?> ().

</body>

Can i change it so, that on this page it always displayed row with exact position in the table - for example second or 15th - independently of row contents and rows deletition, moving or changing in table?

This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

DwFAQ
Participating Frequently
August 1, 2009

Set auto increment int id in database for each record then filter recordset where id = entered value.

August 1, 2009

But if I add 5 rows to table, then delete all of them and add 5 again - auto incremented id will 6 for first in table and 10 for last. If i delete all and add 5 again it will be 11...15 and so on. As I said - I cannot rely on row contens - because I'm planning to delete and add data from that table frequently. Or other solution could be to allways keep id from 1 to [amount of rows]. I do not know how this is done.

Or am I wrong about id?

DwFAQ
Participating Frequently
August 1, 2009

Then add a id row in your database, not auto increment, and in insert record add a field where you can id the record. Then filter recordset based on your inserted record id. It's the same concept in that you're id-ing your record and filtering the recordset based on the id.