I'm using raw queries with laravel 4, is there a way to check affected rows on an insert? DB::getPdo()->rowCount();
gives me an "undefined method" error
. Code is as follows:
$query = "INSERT IGNORE INTO table (id) VALUES (?)";
$doQuery = DB::insert($query, array($value));
if ($doQuery) {
return DB::getPdo()->last();
} else {
return 0;
}
If not, is there an easy way to figure out whether an insert was done or not without making it two queries?