lundi 4 janvier 2016

Laravel 5: differentiate if new row inserted in DB

how can I differentiate if new row inserted or not using Laravel DB::insert()?, my query:

$return = DB::insert("
     INSERT IGNORE INTO groups
     (uid,name)
     VALUES
     ({$uid},'{$name}')
");

echo $return; // 1 in both cases

I found in both cases if new row inserted returns 1 and if not (because of duplication of primary key) returns 1 too.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1RZ6DiC
via IFTTT

Aucun commentaire:

Enregistrer un commentaire