cleaner way to do that
This commit is contained in:
parent
63008cb4de
commit
db7e1f08a9
1 changed files with 6 additions and 10 deletions
16
src/item.php
16
src/item.php
|
@ -181,13 +181,8 @@ if (!empty($_REQUEST["action"])) {
|
|||
}
|
||||
else if ($action == "insert") {
|
||||
if (!$haserror) {
|
||||
if (isset($image_base_filename) && $image_base_filename != "") {
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,description,price,source,category,url,ranking,comment,quantity,image_filename) " .
|
||||
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
} else {
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,description,price,source,category,url,ranking,comment,quantity) " .
|
||||
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
}
|
||||
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,description,price,source,category,url,ranking,comment,quantity,image_filename) " .
|
||||
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(2, $description, PDO::PARAM_STR);
|
||||
$stmt->bindParam(3, $price);
|
||||
|
@ -197,9 +192,10 @@ if (!empty($_REQUEST["action"])) {
|
|||
$stmt->bindParam(7, $ranking, PDO::PARAM_INT);
|
||||
$stmt->bindParam(8, $comment, PDO::PARAM_STR);
|
||||
$stmt->bindParam(9, $quantity, PDO::PARAM_INT);
|
||||
if (isset($image_base_filename) && $image_base_filename != "") {
|
||||
$stmt->bindParam(10, $image_base_filename, PDO::PARAM_STR);
|
||||
}
|
||||
if (!isset($image_base_filename) || $image_base_filename == "") {
|
||||
$image_base_filename = NULL;
|
||||
}
|
||||
$stmt->bindParam(10, $image_base_filename, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
|
||||
stampUser($userid, $smarty->dbh(), $smarty->opt());
|
||||
|
|
Loading…
Add table
Reference in a new issue