witam . mam taki kłopot powiedzmy ze mam listę tematów obok są ikonki ( strzałki w górę i w dół )
przy czym pierwszym rekordzie jest tylko strzałka w dół a ostatnim tylko w górę. jak zrobić coć takiego żeby : jak kliknię na daną strzalke robił update danego rekordu .. ( pola sort )
ja mam taki kod:
ale nic mi do głowy nie przychodzi:
wymyslilem tylko cos takiego zeby pokazywal odp strzalki wedlug w/w schematu
<?php
$varListWykladm = mysql_query (\"SELECT * FROM cours WHERE cours_id = '$cours_id' AND user_id_cours = '$id_user' ORDER by sort DESC LIMIT 1\"); {
$msortZs= $strWdm[\"sort\"];
}
$varListWyklad = mysql_query (\"SELECT * FROM cours WHERE cours_id = '$cours_id' AND user_id_cours = '$id_user' ORDER by sort\");
if ($upt == '1') {
$update_sqls = \"UPDATE cours
SET status = '0'
WHERE id_lesson = '$strIDWyk'\";
$result = $site_db->query($update_sqls);
header(\"Location: coursList.php?cours_id=$cours_id&info=sup\");
}
if ($upt == '0') {
$update_sqls = \"UPDATE cours
SET status = '1'
WHERE id_lesson = '$strIDWyk'\";
$result = $site_db->query($update_sqls);
header(\"Location: coursList.php?cours_id=$cours_id&info=sap\"); }
{
$strNameWyk= $strWd[\"title\"];
$strIDWyk= $strWd[\"id_lesson\"];
$soty= $strWd[\"sort\"];
$widok = $strWd[\"status\"];
if ($widok == '1') {
$st_cours = \"<a href=coursList.php?cours_id=$cours_id&upt=1&strIDWyk=$strIDWyk><img src=gmx/open.gif border=0></a>\";
}else{
$st_cours = \"<a href=coursList.php?cours_id=$cours_id&upt=0&strIDWyk=$strIDWyk><img src=gmx/close.gif border=0></a>\";
}
if ($soty == \"1\") {
$pokaz = \"<img src=\"admin/images/arrow_down.gif\" border=\"0\" > \";
}
if ($soty == \"$msortZs\") {
$pokaz = \"$sn_d <img src=\"admin/images/arrow_up.gif\" border=\"0\">\";
}
if (($soty > \"1\" ) && ($soty < \"1000\" ))
{
$pokaz_ico_two = \"<img src=\"admin/images/arrow_up.gif\" border=\"0\">\";
}
if ($soty == \"$msortZs\") {
$pokaz_ico_two = \"\";
}
if (@$zmC){
$Upsoty = $soty +1;
$pokazSpis .= \"<table height=\"29\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" bgColor=\"#F3F3F3\" id=\"table4\">
<tr>
<td vAlign=\"center\" width=\"52%\" height=\"29\"><b> $soty $strNameWyk</b></td>
<td vAlign=\"center\" width=\"16%\" height=\"29\">
<a href=#$Up$soty>$pokaz</a> $pokaz_ico_two $sn_d
</td>
<td vAlign=\"center\" width=\"10%\" height=\"29\"> <a href=coursUpdate.php?akcion=update&cours_update=$strIDWyk&cours_id=$cours_id><img src=gmx/edit_ico.gif border=0></a></td>
<td vAlign=\"center\" width=\"8%\" height=\"29\"> $st_cours</td>
<td vAlign=\"center\" width=\"8%\" height=\"29\"> <a href=coursList.php?akcja=del&cours_id_del=$strIDWyk&cours_id=$cours_id><img src=\"gmx/del.png\" border=\"0\" onClick=\"return confirm('$dudel_')\";></a></td>
</tr>
</table>\";
$zmC = false;
}else{
$pokazSpis .= \"<table height=\"29\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" bgColor=\"#FFF7F2\" id=\"table4\">
<tr>
<td vAlign=\"center\" width=\"52%\" height=\"29\"><b> $soty $strNameWyk</b></td>
<td vAlign=\"center\" width=\"16%\" height=\"29\">
<a href=#$Up$soty>$pokaz</a> $pokaz_ico_two $sn_d
</td>
<td vAlign=\"center\" width=\"10%\" height=\"29\"> <a href=coursUpdate.php?akcion=update&cours_update=$strIDWyk&cours_id=$cours_id><img src=gmx/edit_ico.gif border=0></a></td>
<td vAlign=\"center\" width=\"8%\" height=\"29\"> $st_cours</td>
<td vAlign=\"center\" width=\"8%\" height=\"29\"> <a href=coursList.php?akcja=del&cours_id_del=$strIDWyk&cours_id=$cours_id><img src=\"gmx/del.png\" border=\"0\" onClick=\"return confirm('$dudel_')\";></a></td>
</tr>
</table>\";
$zmC = true;
}
}
if ($akcja == 'del')
{
// usuwanie rekordu
$sql_del = \"DELETE FROM cours WHERE id_lesson = '$cours_id_del'\";
$pok_sort = mysql_query (\"SELECT * FROM cours WHERE id_lesson = '$cours_id_del'\"); {
$sortID= $varft[\"sort\"];
}
$maxIdcours = mysql_query (\"SELECT * FROM cours WHERE cours_id = '$cours_id'\"); $max = $maxs - 1;
for ($i = $sortID; $i <= $max; $i++) // id które usuwasz i najwieksze id w tablei
{
$z = $i+1;
$na= $i;
$update_sqls = \"UPDATE cours
WHERE
sort = '$z'\"; $result = $site_db->query($update_sqls);
}
?>
"Dla mnie SCHRANZ nigdy nie byl nazwą stulu muzycznego.A raczej określeniem przesterowaniem dzwięków. Czy nawet halasu... Sądzę, że wyroslo nowe pokolenie. które nie chce się identyfikować z techno z trance" - Chris Liebing
www.netklinik.