Advertisement
Guest User

Untitled

a guest
May 26th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. $sql = "INSERT INTO groep (groepid, code, naam, actief) VALUES (?,?,?,?)
  2. ON DUPLICATE KEY UPDATE
  3. id=LAST_INSERT_ID(id),
  4. groepid = VALUES(groepid),
  5. code = VALUES(code),
  6. naam = VALUES(naam),
  7. actief = VALUES(actief)";
  8.  
  9. $statement = $this->connectie->prepare($sql);
  10. if ($statement) {
  11. $statement->bind_param('issi', $groepid, $code, $naam, $actief);
  12. $statement->execute();
  13. return $statement->insert_id;
  14. }
  15.  
  16. return -1;
  17.  
  18.  
  19. example qry:
  20.  
  21. INSERT INTO groep (groepid, code, naam, actief) VALUES (NULL,'SPG','Lekker spelen',1) ON DUPLICATE KEY UPDATE id=LAST_INSERT_ID(id), groepid = VALUES(groepid), code = VALUES(code), naam = VALUES(naam), actief = VALUES(actief)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement