PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/ajax_sort_projects.php

https://bitbucket.org/websightdesigns/project-manager
PHP | 16 lines | 16 code | 0 blank | 0 comment | 1 complexity | b25249fb88e6805f0ae0cf45ff7ad5ed MD5 | raw file
  1. <?php
  2. $debug = 0; // only for testing and debugging, will break otherwise
  3. include("../mysql.php");
  4. $link = mysql_connect($mysqlhost, $mysqluser, $mysqlpass) or die("Could not connect to server");
  5. mysql_select_db($mysqldb) or die("Could not select database");
  6. parse_str($_POST['id'], $sortlist);
  7. $i = 0;
  8. foreach( $sortlist as $name => $array ) {
  9. foreach( $array as $key => $value ) {
  10. $i++;
  11. $update_sql = "UPDATE projects SET sort='" . $i . "' WHERE id='" . $value . "'";
  12. $update_query = mysql_query($update_sql) or die(mysql_error());
  13. }
  14. }
  15. if($debug) { var_dump($sortlist); }
  16. ?>