PDO로 일부 CRUD를 수행하는 컨트롤러를 작성하려고하는데 아무 일도 일어나지 않고이 문제가 발생하지 않습니다. 나는 올바르게 묶는 중이라고 확신하지만, 덤핑 후에는이 문제가 보이지 않고 테이블이 업데이트되지 않는다.PDO 업데이트 문제
누군가 좀 봐 주시겠습니까?.
public function update($query, $array)
{
try
{
$stm = $this->conn->prepare($query);
foreach($array AS $key=>$value)
{
if(gettype($value) == "integer")
{
$stm->bindParam($key,$value,PDO::PARAM_INT);
}
if(gettype($value) == "string")
{
$stm->bindParam($key,$value,PDO::PARAM_STR);
}
}
$stm->execute();
return ($stm->rowCount()<=0) ? FALSE : $stm->rowCount();
}
catch(Exception $e)
{
echo 'Error with the query on line: ' . __LINE__ . ' in file: ' . __FILE__;
}
}
$test = new SQL('127.0.0.1', 'test', '*************', 'mike_test');
$pull = $test->update('UPDATE names SET name=:name WHERE id=:id;',[':name'=>'James',':id'=>2]);