Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include("dbcon.php");
- $act = "";
- $id = 0;
- $name = "";
- $phone = "";
- $birth = "";
- $email = "";
- if( isset($_POST['act']) ){
- $act = $_POST['act'];
- }
- if( isset($_POST['id']) ){
- $id = (int)$_POST['id'];
- }
- if( isset($_POST['name']) ){
- $name = $_POST['name'];
- }
- if( isset($_POST['phone']) ){
- $phone = $_POST['phone'];
- }
- if( isset($_POST['birth']) ){
- $birth = $_POST['birth'];
- }
- if( isset($_POST['email']) ){
- $email = $_POST['email'];
- }
- $count = 0;
- if( $act == "delete" ) {
- if( $id ) {
- $sql = "delete from people where id={$id}";
- $rs = $db->query($sql);
- $count = $rs->rowCount();
- }
- } else if( $act == "insert" ) {
- if( $name && $phone && $birth && $email ) {
- $sql = "insert into people set ";
- $sql .= "name='{$name}'";
- $sql .= ", phone='{$phone}'";
- $sql .= ", birth='{$birth}'";
- $sql .= ", email='{$email}'";
- $rs = $db->query($sql);
- $count = $rs->rowCount();
- }
- }
- echo $count;
Advertisement
Add Comment
Please, Sign In to add comment