3. Data show in table

obviously have to put this code in fresh.php. where have your database connect.

 public function getData($table) {
        $query = mysqli_query($this->connect, "SELECT * FROM $table");
        if (mysqli_num_rows($query) > 0) {
            return mysqli_fetch_all($query, MYSQLI_ASSOC);
        } else {
            return "No data available in yor table $table";



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Show Database</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

        <div style="width: 700px; margin: 0 auto">
        <table class="table table-bordered table-hover" style="text-align: center;">
            $team = $obj->getData("members");
            foreach ($team as $single) {
                    <td><?php echo $id; ?></td>
                    <td><?php echo $name; ?></td>
                    <td><?php echo $email; ?></td>
                    <td><?php echo $phone; ?></td>
                    <td><?php echo $address; ?></td>

Show this like following screenshot:


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s