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