Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
PHP
<?php
include('../includes/connection.php');
 class User
{
public $result = array();

   public function __construct(){
                        $db = new DB_con();
                }
       
 
	##############pagelisting########################
	public function  fetchpages()
    {
  
      	$query = mysql_query("select * from admin_cms_page order by id");
		$result = array();
        while ($record = mysql_fetch_array($query)) {
        echo  $result[] = $record;
    }
    return $result;     
        
    }
	}
	 
 
?>


HTML code:

HTML
<div class="box-body table-responsive">
    <table id="example2" class="table table-bordered table-hover">
      <thead>
        <tr>
          <th>Sl no.</th>
          <th>Page Name</th>
          <th>Page Title</th>
          <th>Action</th>
        </tr>
      </thead>
      <tbody>
        <?php <br mode="hold" /?>                        $page =  $obg->fetchpages('admin_cms_page');?>
        <tr>
          <td><?php echo $i;??></td>
          <td><?php echo $page['pagename'];??></td>
          <td><?php echo $page['pagetitle'];??></td>
          <td><a class="btn btn-primary" href="manage-page.php?id=<?php echo $page['id']; ?>">Edit </a>
            <!-- <a class="btn btn-danger" href="manage-page.php?delete=<?php echo $page['id']; ?>" > Delete </a>-->
          </td>
        </tr>
        
        
      
      </tbody>
    </table>
  </div>
Posted
Updated 27-Mar-16 8:19am
v2
Comments
Richard MacCutchan 17-Dec-14 6:42am    
And what is the question?
ZurdoDev 17-Dec-14 9:32am    
Where is the question?

1 solution

Thanx to all i solved it by own.Below is the updated html coading and php coading will remain same.

<div class="box-body table-responsive">
<table id="example2" class="table table-bordered table-hover">
<thead>
<tr>
<th>Sl no.</th>
<th>Page Name</th>
<th>Page Title</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$page = $obg->fetchpages('admin_cms_page');
$i = 0;
if($page)
{
foreach($page as $page1)
{

$i++;
?>

<tr>
<td><?php echo $i;?></td>
<td><?php echo $page1['pagename'];?></td>
<td><?php echo $page1['pagetitle'];?></td>
<td><a class="btn btn-primary" href="manage-page.php?id=<?php echo $page1['id']; ?>"><i class="fa fa-fw fa-edit"></i>Edit </a>

</td>
</tr>

<?php } } else {?>

<tr>
<td colspan="5" style="color:#FF0000;">No Data Available In The Table.</td>
</tr>
<?php }?>

</tbody>
</table>
</div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900