Jump to content

up and down item


joliocesar

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.