ali nisam siguran da li se vrsi sanacija. Upit mi izgleda ovako prakticno:
Code:
$link = new DB();
$query = "INSERT INTO users (id, name, email) VALUES (?, ?, ?)";
$result = $link->InsertRow($query, [$id, $name, $email]);
if ($result) {
//
}
$link = new DB();
$query = "INSERT INTO users (id, name, email) VALUES (?, ?, ?)";
$result = $link->InsertRow($query, [$id, $name, $email]);
if ($result) {
//
}
Da li tu nešto treba dodati. Ovo je samo primer...
Ovako mi izgleda funkcija 'InsertRow'
Code:
public function InsertRow($query, $params = []) {
try {
$stmt = $this->link->prepare($query);
$stmt->execute($params);
return $stmt->rowCount();
}
catch (PDOException $ex) {
throw new Exception($ex->getMessage());
}
}
public function InsertRow($query, $params = []) {
try {
$stmt = $this->link->prepare($query);
$stmt->execute($params);
return $stmt->rowCount();
}
catch (PDOException $ex) {
throw new Exception($ex->getMessage());
}
}