PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/includes/ajax_sort_clients.php

https://bitbucket.org/websightdesigns/project-manager
PHP | 16 lines | 16 code | 0 blank | 0 comment | 1 complexity | 640d3ffbf8868bdf6bb3cb196c8425ae 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 clients 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. ?>