Thread: Insert/Update
View Single Post
Old 11-15-2012, 02:54 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Inserts and Updates are more simple than Selects, because you don't have to fetch anything. Just call the prepare method:

http://us3.php.net/manual/en/pdo.prepare.php

Be sure to bind the parameters (values) that you will be inserting or updating:

http://us3.php.net/manual/en/pdostatement.bindparam.php

And then call the execute method:

http://us3.php.net/manual/en/pdostatement.execute.php

And finally you can grab the inserted ID using the lastinsertid method:

http://us3.php.net/manual/en/pdo.lastinsertid.php
__________________
Fumigator is offline   Reply With Quote