I was wondering if it is possible to save the data in an HTML list to a database. If so, can I do it with PHP and maybe how?
The reason I want to do so is, I have a javascript that can create lists in HTML. To the list there is a javascript, which makes it possible to drag and sort the list items if you want to do so. All the javascripts are independent of each other.
Now when I have placed my custom list items in the list I would like to be able to save them in the right order in a database. I just can't think of a way to do so, and is it even possible?
Remember that my list is an ordinary HTML <ol></ol>
/ <ul></ul>
-list.
in your database create a column called sequence, or seq, and make it a number.
so now your database has an item and a number. Ford,1: Chevy,2: and so on....
<ol>
<?php
$select = "SELECT carModel from cars order by sequence";
$qry = $db->query($select);
while($row = $qry->fetch())
{
echo "<li>" . $row['carModel'] . "</li>";
}
?>
</ol>
this will give you results in a list ordered by whatever seq you have.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.