aboutsummaryrefslogtreecommitdiff
path: root/admin/newsreel/updateDB.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/newsreel/updateDB.php')
-rw-r--r--admin/newsreel/updateDB.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/admin/newsreel/updateDB.php b/admin/newsreel/updateDB.php
new file mode 100644
index 0000000..a7d25a9
--- /dev/null
+++ b/admin/newsreel/updateDB.php
@@ -0,0 +1,39 @@
+<?php
+
+include '../../includes/debug.php';
+include '../../includes/config.php';
+include '../../includes/sql.class.php';
+include '../functions.php';
+
+$action = $_POST['action'];
+$updateRecordsArray = $_POST['recordsArray'];
+
+$db = new Bayonet_SQL();
+$db->Connect(
+ $config['sql']['hostname'],
+ $config['sql']['username'],
+ $config['sql']['password']
+ );
+$db->Select_db($config['sql']['database']);
+
+if ($action == "updateReelOrder"){
+
+ $listingCounter = 1;
+ foreach ($updateRecordsArray as $recordIDValue) {
+
+ $db->Query("UPDATE `bayonet_newsreel` SET `weight` = '$listingCounter' WHERE `slide_id` = '$recordIDValue'");
+ //mysql_query($query) or die('Error, insert query failed');
+ $listingCounter = $listingCounter + 1;
+ }
+ echo "<img src=\"images/accepted.png\" />";
+/*
+ echo '<pre>';
+ print_r($updateRecordsArray);
+ echo '</pre>';
+ echo 'If you refresh the page, you will see that records will stay just as you modified.';
+*/
+}
+else{
+ echo "<img src=\"images/rejected.png\" />";
+}
+?> \ No newline at end of file