Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/irp/operator/
Upload File :
Current File : /var/www/html/mmishra/irp/operator/msqli.php

<?php
$mysqli = new mysqli("localhost", "root", "", "irp");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$query = "SELECT dept_code,dept_name,account_no,financial_year,fund_granted,fund_spent,fund_available,hod_name,designation FROM departments";

if ($stmt = $mysqli->prepare($query)) {

    /* execute statement */
    $stmt->execute();

    /* bind result variables */
    $stmt->bind_result($code, $name, $account_no, $financial_year, $fund_granted, $fund_spent, $fund_available, $hod_name, $designation);

    /* fetch values */
    while ($stmt->fetch()) {
        echo "$code, $name, $account_no, $financial_year, $fund_granted, $fund_spent, $fund_available, $hod_name, $designation<br>";
    }

    /* close statement */
    $stmt->close();
}

/* close connection */
$mysqli->close();
?>