superbrad Posted October 14, 2010 Share Posted October 14, 2010 Hello! First Post! Yay! I have a web application in which I use scriptaculous' sortable and mysql. The sortable posts its order to my mysql database thanks to a "ranking" field, and it works fine. There is another list on the page that reads the ranking from the sortable and displays the list again, but this time non-sortable. On update of the sortable, and after posting the data to the mysql database, the list refreshes thanks to an AJAX div refresh. There lies the problem. When the div refreshes, sometimes it refreshes with the list displayed in the correct order, sometimes it displays in an incorrect order. Sometimes it seems like it may be lagging 1-2 updates behind. I know that it isn't the post of the sortable data, because I check the data in phpMyAdmin after an update and it is always correct. Also, it isn't the code which displays the list I don't think, because when I refresh the browser, that same code displays the list correctly. Is there just something that I'm missing here? Here's the code that reads the data for the list, and displays it: require('database2.php'); function getMovies2() { $query = 'select movie_id, title from movies order by ranking, lower(title)'; $result = mysql_query($query) or die(mysql_error()); $movies = array(); while ($row = mysql_fetch_object($result)) { $movies[$row->movie_id] = $row->title; } return $movies; } $movies = getMovies2(); ?> <ul id="movies_list"> <?php foreach ($movies as $movie_id => $title) { ?> <li id="movie_<?= $movie_id ?>"><h3><?= $title ?></h3> </li> <?php } ?> </ul> Quote Link to comment https://forums.phpfreaks.com/topic/215846-scriptaculous-acting-weird-might-be-mysql/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.