anonīms Posted July 21, 2011 Report Share Posted July 21, 2011 Mazs interesējošs jautājums tik. Kā labāk būtu pievienojot datus db, ja var būt tā, ka viņi nemaz nav iekšs db. Kuru shēmu? 1) query("DELETE FROM blabla WHERE id = 1"); query("INSERT INTO blabla (1) VALUES (1)"); 2) $check = query("SELECT"); // vai ir db if(nav) { insert } else { update } kurš varētu būt ātrāks? Quote Link to comment Share on other sites More sharing options...
mad182 Posted July 21, 2011 Report Share Posted July 21, 2011 http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html http://dev.mysql.com/doc/refman/5.0/en/replace.html Quote Link to comment Share on other sites More sharing options...
Maris-S Posted July 21, 2011 Report Share Posted July 21, 2011 Paskaties šo: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html iespējams ka noder. Jāņem vērā ka pie kļūdām, kad ieraksts neievietojas autoincrement koloniņa vienalga palielināsies, ja tas ir aktuāli protams. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.