TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
PALASH KAYAL
NA
17
1.5k
Message: Undefined variable: pk
Sep 13 2018 1:44 PM
DataModel.php/MODEL
===================
<?php
class DataModel extends Roll_Model
{
public function Data_list()
{
$this->db->cache_on();
$query = $this->db->query("SELECT * FROM user_reg");
//$query=$this->db->get('user_reg');
return $query->result();
}
}
View_all.php/VIEW
=================
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Products</title>
<style>
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
#infoMessage p{
padding: .8em;
margin-bottom: 1em;
border: 2px solid #ddd;
background: #FFF6BF;
color: #817134;
border-color: #FFD324;
text-align: center;
}
</style>
</head>
<body>
<table width="700" border="0" align="center">
<tr>
<td>
<h2 align="center">All Data (<a href="<?php echo base_url('REPORT')?>">View All Data</a>)
</h2>
</td>
</tr>
<tr>
<td>
<div id="infoMessage"><!--?php echo $message;?--></div>
</td>
</tr>
<tr>
<td>
<input name="New" type="button" value="Add New" onclick="window.location='#'" />
</td>
</tr>
</table>
<form name="frmproduct" method="post">
<input type="hidden" name="rid" />
<input type="hidden" name="command" />
<table width="700" align="center">
<tr>
<th width="100"><strong>Users ID</strong></th>
<th width="100"><strong>Name</strong></th>
<th width="100"><strong>Subject</strong></th>
<th width="100"><strong>Address</strong></th>
<th width="100"><strong>Contact</strong></th>
<th width="100"><strong>Email</strong></th>
<th width="100"><strong>Password</strong></th>
<th width="100"><strong>Action</strong></th>
</tr>
<?php
echo "<pre>";
foreach($fetch->result() as $row)
{
?>
<tr>
<td><?php echo $row->U_id; ?></td>
<td><?php echo $row->Uname; ?></td>
<td><?php echo $row->subject; ?></td>
<td><?php echo $row->address; ?></td>
<td><?php echo $row->Contact; ?></td>
<td><?php echo $row->email; ?></td>
<td><?php echo $row->pass; ?></td>
<td><button>Edit</button> <button>Delete</button></td>
</tr>
<?php
}
?>
</table>
</form>
</body>
Admin.php/CONTROLLER
====================
<?php
class Admin extends All_Users
{
public function dashboard()
{
$this->load->model('DataModel');
$fetch["pk"] = $this->DataModel->Data_list();
$this->load->view('public/View_all', $fetch);
}
}
Attachment:
Error.rar
Reply
Answers (
0
)
Message: Call to undefined method CI_DB_mysqli_driver::affec
How to track email using php