Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: application/json');
- $user = 'root';
- $password = 'Knight93';
- $dbh = new PDO('mysql:host=localhost;dbname=tdpx', $user, $password);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $sth = $dbh->prepare("UPDATE part SET productID=:productid, name=:description, weight=:weight WHERE id=:id");
- if($sth->execute(array('productid' => $_POST['productid'], 'description' => $_POST['description'], 'weight' => $_POST['weight'], 'id' => $_POST['id']))){
- echo "{'success':true}";
- }else{
- $error = print_r($sth->errorInfo());
- echo "{'success':false, 'error: " .$error."}";
- }
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement