-4

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\payroll\payroll\home_employee.php on line 7

 <?php

 include("auth.php"); //include auth.php file on all secure pages
 include("add_employee.php");
 $query = ("SELECT * FROM deductions WHERE deduction_id='1'");
 $result = mysql_query($query);
 while($row = mysql_fetch_array($result));
 {

      $phil = $row["philhealth"];
      $bir = $row["bir"];
      $gsis = $row["gsis"];
      $love = $row["pag_ibig"];
      $loans = $row["loans"];
 }
 ?>
floriank
  • 25,416
  • 9
  • 40
  • 66
Berto
  • 1
  • 4

1 Answers1

0

Use mysqli to connect. Try this

$link = mysqli_connect($host, $username, $password, $dbname);
$query = "SELECT * FROM deductions WHERE deduction_id='1'";
$result = mysqli_query($query);
foreach ($result as $key => $row){
    $phil = $row["philhealth"];
    $bir = $row["bir"];
    $gsis = $row["gsis"];
    $love = $row["pag_ibig"];
    $loans = $row["loans"];
}
Hello World
  • 1,986
  • 5
  • 24
  • 52