~ubuntu-branches/ubuntu/utopic/jquery-goodies/utopic

« back to all changes in this revision

Viewing changes to treetable/examples/ajax_php_sqlite/move.php

  • Committer: Bazaar Package Importer
  • Author(s): Marcelo Jorge Vieira (metal)
  • Date: 2011-07-25 15:39:18 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110725153918-mig1d2wa18u168cr
Tags: 4-1
* New Upstream Version
  + Added jQuery-metadata
  + Added jQuery-tablesorter, thanks Ben Finney (Closes: #631219, #584127)
  + Added jQuery-treetable (Closes: #584403)
  + Added jQuery-livequery
  + Fixed wrong path to images in the jQuery-fancybox (Closes: #628029)
* Updated Standards-Version to 3.9.2 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * PUT /move.php?id=3&to=6
 
5
 *
 
6
 * Moves node with id 3 to it's new parent with id 6.
 
7
 */
 
8
$parent_id = substr($_POST['to'], 5);
 
9
$id = substr($_POST['id'], 5);
 
10
 
 
11
$dbh = new PDO('sqlite:db/database.sqlite3');
 
12
$sth = $dbh->prepare('UPDATE items SET parent_id = :parent_id WHERE id = :id');
 
13
$passed = $sth->execute(array(':parent_id' => (int) $parent_id, ':id' => (int) $id));
 
14
 
 
15
echo $passed ? "Moving {$id} to {$parent_id}" : var_dump($sth->errorInfo());
 
16
 
 
17
?>
 
 
b'\\ No newline at end of file'