joliocesar Posted September 29, 2008 Share Posted September 29, 2008 hi , have a database named 'internet_links' that had 5 fields ... id , title , address , user , num i show this items on my pages , for example google / google.com / admin yahoo / yahoo.com / admin i want get up and down items in my database table .. change it by a link up or down for example change it : google / google.com / admin yahoo / yahoo.com / admin to : yahoo / yahoo.com / admin google / google.com / admin thanks Quote Link to comment Share on other sites More sharing options...
joliocesar Posted September 29, 2008 Author Share Posted September 29, 2008 oh i dont know i was selected true part for this question ! if this is not true ! i'm apologize ... i'm new user Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 29, 2008 Share Posted September 29, 2008 array way.... <?php $W=array("yahoo" , "yahoo.com" , "admin" , "google" , " google.com " , "admin"); echo " <BR> $W[0] / $W[1] / $W[2] <BR> $W[3] / $W[4] / $W[5] <BR>"; ?> database way.... <?php //database names("yahoo" , "yahoo.com" , "admin" , "google" , " google.com " , "admin"); //database connection $sql="SELECT * FROM database_field"; $result=mysql_query($sql)or die(mysql_error()); while($W=mysql_fetch_assoc($result)){ echo " <BR> ".$W['0']." / ".$W['1']." / ".$W['2']." <BR> ".$W['3']." / ".$W['4']." / ".$W['5']." <BR>"; } ?> Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 29, 2008 Share Posted September 29, 2008 just change the SQL between these two values: ORDER by title ASC or ORDER by title DESC Example: SELECT * FROM table ORDER BY title DESC Quote Link to comment Share on other sites More sharing options...
joliocesar Posted September 29, 2008 Author Share Posted September 29, 2008 thanks , but i want change arrangement ! (change order) of table contents ... for example i create new field named (orders) and put number in that ... and if user click on up link ... one added to ordes ... and show it by $select = "select * from field order by orders asc" ! now i don't know how add number when i added item to databace .. thankx Quote Link to comment Share on other sites More sharing options...
revraz Posted September 29, 2008 Share Posted September 29, 2008 Javascript would be the easiest. Quote Link to comment Share on other sites More sharing options...
joliocesar Posted September 29, 2008 Author Share Posted September 29, 2008 hi revraz , javascript can connect to database and content can always stay in db ? can you show me a example please thanx Quote Link to comment Share on other sites More sharing options...
revraz Posted September 29, 2008 Share Posted September 29, 2008 What you do is read the current order in, let Javascript change them around, then when done, hit a Save button and write it back. Ask in the JS forums. Quote Link to comment Share on other sites More sharing options...
ram4nd Posted September 29, 2008 Share Posted September 29, 2008 I would do it somehow with using ids. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted September 29, 2008 Share Posted September 29, 2008 you could use AJAX to accomplish this... I just currently implemented a Drag and drop sortable list using AJAX... It connets to the DB immediately and saves the order Quote Link to comment Share on other sites More sharing options...
joliocesar Posted September 29, 2008 Author Share Posted September 29, 2008 thanks Quote Link to comment 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.