Compare commits
No commits in common. "c7545691430287377b3fd4cf1a46fa334b7cf002" and "0d811dd059339fae43cab60c0085bff9f5e78fcd" have entirely different histories.
c754569143
...
0d811dd059
@ -44,7 +44,7 @@ class BancaDati {
|
|||||||
$value = "";
|
$value = "";
|
||||||
$column = "";
|
$column = "";
|
||||||
foreach ($values as $col => $v){
|
foreach ($values as $col => $v){
|
||||||
$value .= "'" . $v . "',";
|
$value .= $v . ",";
|
||||||
$column .= $col . ",";
|
$column .= $col . ",";
|
||||||
}
|
}
|
||||||
$value = trim($value, ",");
|
$value = trim($value, ",");
|
||||||
@ -70,7 +70,7 @@ class BancaDati {
|
|||||||
public function update(string $table, string $id, array $values){
|
public function update(string $table, string $id, array $values){
|
||||||
$value = "";
|
$value = "";
|
||||||
foreach ($values as $col => $v){
|
foreach ($values as $col => $v){
|
||||||
$value .= $col . "='" . $v . "',";
|
$value .= $col . "=" . $v . ",";
|
||||||
}
|
}
|
||||||
$value = trim($value, ",");
|
$value = trim($value, ",");
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class BancaDati {
|
|||||||
* @author Malte Schulze Hobeling
|
* @author Malte Schulze Hobeling
|
||||||
*/
|
*/
|
||||||
public function delete(string $table, string $id){
|
public function delete(string $table, string $id){
|
||||||
$sql = "DELETE FROM " . $table . " WHERE `id` = '" . $id . "';";
|
$sql = "DELETE FROM " . $table . " WHERE `id` = " . $id . ";";
|
||||||
try {
|
try {
|
||||||
$sth = $this->pdo->prepare($sql);
|
$sth = $this->pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@ -114,9 +114,9 @@ class BancaDati {
|
|||||||
if($whereString != ""){
|
if($whereString != ""){
|
||||||
$whereString .= " AND ";
|
$whereString .= " AND ";
|
||||||
}
|
}
|
||||||
$whereString .= "`" . $col . "` = '" . $v . "'";
|
$whereString .= $col . " LIKE " . $v;
|
||||||
}
|
}
|
||||||
$sql = "SELECT * FROM ".$table." WHERE ".$whereString.";";
|
$sql = "SELECT * FROM ".$table." WHERE ".$whereString;
|
||||||
if(isset($order["by"])){
|
if(isset($order["by"])){
|
||||||
$sql .= " ORDER BY ".$order["by"];
|
$sql .= " ORDER BY ".$order["by"];
|
||||||
}
|
}
|
||||||
@ -124,7 +124,6 @@ class BancaDati {
|
|||||||
$sql .= $order["order"];
|
$sql .= $order["order"];
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
var_dump($sql);
|
|
||||||
return $this->pdo->query($sql);
|
return $this->pdo->query($sql);
|
||||||
}catch (PDOException $e){
|
}catch (PDOException $e){
|
||||||
die;
|
die;
|
||||||
|
Loading…
Reference in New Issue
Block a user