Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- $dbuser="root";
- $dbpass="";
- $dbhost="localhost";
- $dbname="salon";
- $conn=new PDO("mysql:host={$dbhost};dbname={$dbname}",$dbuser,$dbpass);
- ?>
- /////////////////////////////////INSERT///////////////////////////////////////
- <?php
- if(isset($_POST['submit'])){
- $amount=$_POST['amount'];
- $email=$data['email'];
- $no=$data['staff_no'];
- $username=$data['username'];
- $q=$conn->prepare("INSERT INTO salary(staff_no,staff_name,staff_email,amount)VALUES(?,?,?,?)");
- $q->bindParam(1,$no);
- $q->bindParam(2,$username);
- $q->bindParam(3,$email);
- $q->bindParam(4,$amount);
- $q->execute();
- header("location:staff.php?paid");
- }
- ?>
- /////////////////////////////////FETCH///////////////////////////////////////
- <?php
- $sql=$conn->prepare("SELECT * FROM bookings");
- $sql->execute();
- $fetch=$sql->fetchAll();
- ?>
- <table>
- <thead>
- <tr>
- <th>ID</th>
- <th>Name</th>
- </tr>
- </thead>
- <tbody>
- <?php foreach($fetch as $nums){ ?>
- <tr>
- <td><?php echo $nums['id'];?></td>
- <td><?php echo $nums['name'];?></td>
- </tr>
- }
- </tbody>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement