|
Posted by Jerry Stuckle on July 13, 2008, 10:29 am
Please log in for more thread options php_mysql_beginer911 wrote:
> Hi HTH,
> thanks for the answer ...
> i am sorry for my poor english .. as i am not a native speaker.
> i hope i can explain better this time..
>
> so here i go again ..
>
> i have page where i can see the list of files which are in db and
> allready have sequence numbers like 1,2,3.... which i can use to order
> them by using mysql oreder by .. i am using drag and drop so i can
> rearrange the file sequences that means if i want to see the first
> file in 2nd row i will simply drag it to the 2nd row and hit the
> update button which will update the sequence field with new value in
> db
> i am using jquery plugin for drag and drop.. may be if you can see the
> page you can understand better
>
> http://www.isocra.com/2008/02/table-drag-and-drop-jquery-plugin/
>
> in simple words i am updating the new file sequence after i am done
> changing its old position by using drag and drop feature .... and i am
> updating it with new values (using file_id[] hidden field which
> contents file_id and new sequence number which i can get from table
> row id by using jquery plugin )that means if there are 300 files than
> my mysql update query will run 300 times .. all i am wondering is that
> is there a better way to do this .. which can improve the
> performance .. all i can think is that not updating those sequence
> fields which were not changed by comparing them with old values when i
> am doing the update in a loop .
>
> hope my explanation is not confusing ...
> and thanks again for giving your precious time to this post
>
>
>
From the PHP end, there isn't much you can do other than check against
the old value and not UPDATE if they are the same. Of course. there are
various ways to do this - i.e. if you move a file from position 6 to
position 2, you can easily determine only the old positions 2-6 need to
be changed.
But depending on how you do thing, there might be mysql ways of doing it
also. Try comp.databases.mysql for suggestions.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
|