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 Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/ 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 Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653072 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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653084 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 Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653107 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 Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653136 Share on other sites More sharing options...
revraz Posted September 29, 2008 Share Posted September 29, 2008 Javascript would be the easiest. Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653145 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 Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653150 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. Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653154 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. Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653159 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 Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653174 Share on other sites More sharing options...
joliocesar Posted September 29, 2008 Author Share Posted September 29, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/126299-up-and-down-item/#findComment-653207 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.