Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Set auto increment int id in database for each record then filter recordset where id = entered value.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Yeah, I think it is the only way, but still seems a little freaky to me that there are no simple (or any) solutions to pick some row depending only on the position in table. I'll leave it unanswered - I think the answer might be helpful in some situations. But anyway - thank You.
Copy link to clipboard
Copied
What exactly do you mean by a row's position in a table? Rows in tables are not stored in any particular position.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now