About Me
   Rene's Resume
   Rates & Contracts
   Portfolio / Clients
   Demo Apps
   White Papers & Tips
   Contact Me

Insert, Update and Delete

Actually, all of these three database routines are SQL calls that don't return anything other than the number of affected rows. The Perl DBI interface lumps them all under the "do" directive. It would certainly be possible to do the same thing under PHP. I've chosen to break it out into three separate calls because having different routine names makes the code you write a bit easier to read. Self-documentation is all it is.

5.1 Insert

    $sql->Insert("insert into TEST values (0,'J.D.','18','23000')");
    $affected_rows = $sql->a_rows;

5.2 Update

    $sql->Update("update TEST set Name = 'Jane Doe' where ID = 6");
    $affected_rows = $sql->a_rows;

5.3 Delete

    $sql->Delete("delete from TEST where ID = 4");
    $affected_rows = $sql->a_rows;

This page was generated in 0.0008 seconds.
Website content © 2024