fix: select values with single quotes
This commit is contained in:
parent
23cf1b54e4
commit
e1a0f112a2
@ -51,7 +51,6 @@ class BancaDati {
|
|||||||
$column = trim($column, ",");
|
$column = trim($column, ",");
|
||||||
|
|
||||||
$sql = "INSERT INTO $table ($column) VALUES ($value);";
|
$sql = "INSERT INTO $table ($column) VALUES ($value);";
|
||||||
var_dump($sql);
|
|
||||||
try {
|
try {
|
||||||
$sth = $this->pdo->prepare($sql);
|
$sth = $this->pdo->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
@ -109,9 +108,10 @@ class BancaDati {
|
|||||||
if($where != ""){
|
if($where != ""){
|
||||||
$where .= " AND ";
|
$where .= " AND ";
|
||||||
}
|
}
|
||||||
$where .= $col . "=" . $v;
|
$where .= $col . "=" . "'" . $v . "'";
|
||||||
}
|
}
|
||||||
$sql = "SELECT * FROM ".$table." WHERE ".$where;
|
$sql = "SELECT * FROM ".$table." WHERE ".$where;
|
||||||
|
var_dump($sql);
|
||||||
if(isset($order["by"])){
|
if(isset($order["by"])){
|
||||||
$sql .= " ORDER BY ".$order["by"];
|
$sql .= " ORDER BY ".$order["by"];
|
||||||
}
|
}
|
||||||
@ -121,6 +121,7 @@ class BancaDati {
|
|||||||
try {
|
try {
|
||||||
return $this->pdo->query($sql);
|
return $this->pdo->query($sql);
|
||||||
}catch (PDOException $e){
|
}catch (PDOException $e){
|
||||||
|
var_dump($e);
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user