Jump to content

superbrad

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

superbrad's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.