Quote:
Originally Posted by komrad
Hello all,
I'd like to know if there is a way to insert into a MYSQL table data in an ordered way?
Right now as a workaround I've literally made a table of questions with questionID as primary key, nextQuestion and prevQuestion pointing to other questionIDs. Basically I've made a two way linked list from scratch. Is there anything built into MYSQL that implements this?
Thanks in advance.
|
It seems like you want a way to automagically point to the previous/next records for navigational purposes.
If that's what it is, you can just do a query for each-
Code:
<?php
$previous = mysql_query(sprintf("SELECT questionID FROM [table] WHERE (questionID < %d) LIMIT 1", $currentQuestionId));
$next = mysql_query(sprintf("SELECT questionID FROM [table] WHERE (questionID > %d) LIMIT 1", $currentQuestionId));
?>
That's a very rudimentary way of doing it.
Not sure if that helps, but it's all I could do given the info.