Closed nealoke closed 7 years ago
the update() always return a PDO statement... that is expected.
if you want to test if the update() is successfull you can use error() depending of what you want to know about the update of course. Per example for my script i always use a wrapper that return me always same output.
per example : return [0 => TRUE|FALSE, 1=> $rows]
Where $rows are an array. could have the result or else depending of the query wrapper.
Affected rows stored in rowCount():
$medoo->pdo->rowCount();
or try this:
$updateResult = $medoo->update(/* ... */);
$updateResult->rowCount();
source:
Ooh waaw, I'm not sure how I missed this... Thanks for the input @turbopixel and @superdeeid
It's not a string. It's PDO statement object. You can use its methods for whatever you needed. Like ->rowCount()
getting the number row affected, or ->errorInfo()
for error info.
Hi, first of all thanks for this superb lib 🔥
I'm currently using it a lot and for some reason with one statement I always receive the
queryString
back when performing->update('table', $params, ['id' => $id])
. This only happens with one case and I can't seem to figure out why. Any help would be awesome!Example output
eg. print_r($medoo->update('table', $params, ['id' => $id]))
->error()
->debug()