[COLOR=#003366]Hi guys, [/COLOR]
[COLOR=#003366]i posted this question some time ago on here and did get some help. Through the help that i got and a script i came across i was able to sort of get the display ordering working. So i thought…
THe information is displayed but when i try to set the new display order nothing changes.
<?
include('common.php');
$link = dbConnect();
$contentresequencer = $_POST['contentresequencer'];
$contentsequence = $_POST['contentsequence'];
if (isset($contentresequencer)) {
$sequenceOKlessthanid=$contentresequencer-1;
$sequenceOKgreaterthanid=$contentsequence+1;
$resequencedid=$contentresequencer;
$sequenceSORTBYorder="DESC";
if ($contentresequencer>$contentsequence) {
$sequenceOKlessthanid=$contentsequence-1;
$sequenceOKgreaterthanid=$contentresequencer;
$resequencedid-=1;
$sequenceSORTBYorder="ASC";
}
$query = "SELECT * FROM jcbLets WHERE contentsequence > $sequenceOKlessthanid AND contentsequence < $sequenceOKgreaterthanid
ORDER BY contentsequence $sequenceSORTBYorder";
$result = mysql_query ($query) or die ("<p><b>ERROR!!!</b></p><BR>".$query."<BR>");
$j=0;
while ($rows = mysql_fetch_object($result)) {
$contentid = $rows->letID;
$updateset = $resequencedid;
if ($j!=0) {
$contentsequence = ($rows->contentsequence)+1;
if ($sequenceSORTBYorder=="ASC") {
$contentsequence-=2;
$updateset = $contentsequence;
}
$updatequery = "UPDATE jcbLets SET contentsequence='$updateset' WHERE letID='$contentid'";
$updateresult = mysql_query ($updatequery) or die ("<p><b>ERROR!!!</b></p><BR>".$updatequery."<BR>");
$j+=1;
}
}
}
$query = "SELECT * FROM jcbLets ORDER BY contentsequence";
$result = mysql_query ($query) or die ("<p><b>ERROR!!!</b></p><BR>".$query."<BR>");
$cnt= mysql_num_rows($result);
$j=0;
?>
<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2" valign="top"><b>To move a paragraph to a new sequence position, select from the drop down list next to it the position you want the moved paragraph to:</b><br><br></td></tr>
<?
$alternate = "2";
while ($rows = mysql_fetch_object($result)) {
if ($alternate == "1") {
$color = "#ffffff";
$alternate = "2";
} else {
$color = "#efefef";
$alternate = "1";
}
$j+=1;
$contentsequence = $rows->contentsequence;
$contentid = $rows->letID;
?>
<tr bgcolor=<? echo $color ?>><td width="600" height="30"> <?=stripslashes($rows->letAddress1)?></td><td><form name="hiddenresequenceform<?=$contentsequence?>" method="post">
<INPUT NAME="contentsequence" TYPE="hidden" VALUE="<?=$contentsequence?>">
<INPUT NAME="contentid" TYPE="hidden" VALUE="<?=$contentid?>">
<select name="contentresequencer" onChange="document.hiddenresequenceform<?=$contentsequence?>.submit()">
<?
$selected = "";
$beginning = "At the Beginning";
if ($j==1)
{
$selected = " selected";
$beginning = "1 (Current position)";
}
?>
<option value="1"<?=$selected.'>'.$beginning?> </option>
<?
for ($i=2; $i<=$cnt; $i++)
{
$selected = "";
$currentposition = "";
if ($i==$j){
$selected = " selected";
$currentposition = " (Current position)";
}
if ($i!=($j+1)) {
$above = "";
if ($i>($j+1)){
$above = "Above ";
}
?>
<option value=<?=$i.$selected.'>'.$above.$i.$currentposition?></option>
<?
}
}
?>
<option value=<?=$i?>>At the End</option></select></form></td></tr>
<?
}
?>
I am hoping that it is just a typo somewhere.[/COLOR]
[COLOR=#003366]Any help much appreciated
http://www.innovativedesigns.me.uk/jcb/admcms/sortNew.php
Thanks
Paul[/COLOR]