public function updateUploaded($uploaded) { /** @var Uploaded $uploaded */ $sqlInsert = "UPDATE uploaded SET name = :name,\n imageURL = :imageURL,\n username = :username,\n realPrice = :realPrice,\n mesoPrice = :mesoPrice,\n status = :status,\n statusTimestamp = :statusTimestamp,\n description = :description,\n serverID = :serverID WHERE\n id = :id;"; $dbh = new PDO(DBconfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD); $stmt = $dbh->prepare($sqlInsert); $stmt->bindParam(':name', $uploaded->name); $stmt->bindParam(':imageURL', $uploaded->imageURL); $stmt->bindParam(':username', $uploaded->username); $stmt->bindParam(':realPrice', $uploaded->realPrice); $stmt->bindParam(':mesoPrice', $uploaded->mesoPrice); $stmt->bindParam(':status', $uploaded->status); $stmt->bindParam(':statusTimestamp', $uploaded->statusTimestamp); $stmt->bindParam(':description', $uploaded->description); $stmt->bindParam(':id', $uploaded->id); $stmt->bindParam(':serverID', $uploaded->serverID); $binds = array(":name" => $uploaded->name, ":imageURL" => $uploaded->imageURL, ":username" => $uploaded->username, ":realPrice" => $uploaded->realPrice, ":mesoPrice" => $uploaded->mesoPrice, ":status" => $uploaded->status, ":statusTimestamp" => $uploaded->statusTimestamp, ":description" => $uploaded->description, ":serverID" => $uploaded->serverID, ":id" => $uploaded->id); $logDAO = new LogDAO(); if ($stmt->execute()) { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'SUCCESS'); return true; } else { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'FAILED'); return false; } }
public function updateOrder($order) { /** @var Order $order */ $sqlInsert = "UPDATE orders SET goodsID = :goodsID,\n username = :username,\n orderType = :orderType,\n priceType = :priceType,\n price = :price,\n quantity = :quantity,\n status = :status,\n statusTimestamp = :statusTimestamp WHERE\n id = :id;"; $dbh = new PDO(DBconfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD); $stmt = $dbh->prepare($sqlInsert); $stmt->bindParam(':goodsID', $order->goodsID); $stmt->bindParam(':username', $order->username); $stmt->bindParam(':orderType', $order->orderType); $stmt->bindParam(':priceType', $order->priceType); $stmt->bindParam(':price', $order->price); $stmt->bindParam(':quantity', $order->quantity); $stmt->bindParam(':status', $order->status); $stmt->bindParam(':statusTimestamp', $order->statusTimestamp); $stmt->bindParam(':id', $order->id); $stmt->bindParam(':serverID', $order->serverID); $binds = array(":goodsID" => $order->goodsID, ":username" => $order->username, ":orderType" => $order->orderType, ":priceType" => $order->priceType, ":price" => $order->price, ":quantity" => $order->quantity, ":status" => $order->status, ":statusTimestamp" => $order->statusTimestamp, ":id" => $order->id, ":serverID" => $order->serverID); $logDAO = new LogDAO(); if ($stmt->execute()) { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'SUCCESS'); return true; } else { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'FAILED'); return false; } }
public function createGood($good) { /** @var Good $good */ $sqlInsert = "INSERT INTO goods VALUES(NULL, :name, :imageURL, :description);"; $dbh = new PDO(DBconfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD); $stmt = $dbh->prepare($sqlInsert); $stmt->bindParam(':name', $good->name); $stmt->bindParam(':imageURL', $good->imageURL); $stmt->bindParam(':description', $good->description); $binds = array(":name" => $good->name, ":imageURL" => $good->imageURL, ":description" => $good->description); $logDAO = new LogDAO(); if ($stmt->execute()) { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'SUCCESS'); return true; } else { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'FAILED'); return false; } }
public function createNewUser($user) { /** @var User $user */ $sqlInsert = "INSERT INTO users VALUES(:username, :password, :email, :referrer, :referlink, 1);"; $dbh = new PDO(DBconfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD); $stmt = $dbh->prepare($sqlInsert); $stmt->bindParam(':username', $user->username); $stmt->bindParam(':password', $user->password); $stmt->bindParam(':email', $user->email); $stmt->bindParam(':referrer', $user->referrer); $stmt->bindParam(':referlink', $user->referlink); $binds = array(":username" => $user->username, ":password" => $user->password, ":email" => $user->email, ":referrer" => $user->referrer, ":referlink" => $user->referlink); $logDAO = new LogDAO(); if ($stmt->execute()) { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'SUCCESS'); return true; } else { $logDAO->logPreparedStatement('INSERT', $stmt, $binds, 'FAILED'); return false; } }