close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

re-ordering items in a results page

Thread began 5/31/2013 12:20 pm by Jamie | Last modified 5/31/2013 3:39 pm by Jamie | 172 views | 2 replies

Jamie

re-ordering items in a results page

Hi Jason

In the backend of a site I have created a results page which allows the user to re-order items in the list. I have used this loads of times succcessfully, but for some reason, and I cannot see why or what I have done wrong on this occasion, but when I click on 'update order' I get the following:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Order = 1 WHERE OffersID = 3' at line 1


My table is named special_offers and the columns in it are OffersID, Date, OfferTitle, OfferContent, MetaTitle, MetaDescription, Live, Order

Here from the the code that I have been using, and the other code snippet is what I am using in the table within the form itself.

<?php
function cmp($a, $b) {
return ($a[2] < $b[2] || ($a[2] == $b[2] && $b[2] == $b[1]))? -1: 1;
}
if (isset($_POST["UpdateOrder"])) {
$OrderArray = array();
$start = 1;
while (isset($_POST["OffersID_".$start])) {
$OrderArray["SpecialOffers_". $_POST["OffersID_".$start]] = array($_POST["OffersID_".$start],$start,$_POST["Order_".$start]);
$start ++;
}
$start = 1;
uasort($OrderArray, "cmp");
foreach ($OrderArray as $SpecialOffers) {



mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$query_WADAspecial_offers = "UPDATE special_offers SET Order = ". $start ." WHERE OffersID = " . intval($SpecialOffers[0]);
$WADAspecial_offers = mysql_query($query_WADAspecial_offers, $PowerCMSConnection) or die(mysql_error());
$start++;
}
}
?>





<?php
$curOrder = 0;
?>
<?php do { ?>
<?php
$curOrder ++;
?>
<tr class="<?php echo($WARRT_AltClass1->getClass(true)); ?>">
<td width="30" class="WADAResultsTableCell" style="text-align:center;"><label for="Order"></label>
<input type="text" name="Order_<?php echo($curOrder); ?>" value="<?php echo($curOrder); ?>" style="width:25px; text-align:center;">
<input type="hidden" name="OffersID_<?php echo($curOrder); ?>" value="<?php echo($row_WADAspecial_offers['OffersID']); ?>">



Any light you may be able to shed on what and where I am going wrong gratefully received. If you need any files or access just let me know.

Cheers

Jamie

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...