Welcome Guest, Not a member yet? Register   Sign In
what wrong
#1

[eluser]mom_maj[/eluser]
thats code
performed i bring many row from DB and pass it to view page ,it give me error and that is :

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: row

Filename: views/view.php

Line Number: 16

my cod is:
model:
function viwe()
{
$this->user_model->islogin();
$user_id = $this->session->userdata('user_id');
//connect to DB
$sql = "SELECT
*
FROM
list
WHERE
user_id= '$user_id'
";
$query = $this->db->query($sql);
if ($query->num_rows() == 0){
$this->load->view('view');
$comment=array('no_list'=> 'There Are No List In The Data Base');
$this->load->vars($comment);
} else {

$row =$query->result_array();
$this->load->view('view',$row);
}
}

view:

<?php


?>
<html>
<form method="POST" action="delete">
<table border='1'>
<tr><th>X</th> <th>Title</th> <th>Description</th><th>Status</th><th>Date</th><th>Action</th></tr>
&lt;?echo 'This Is The List Of Your Order';?&gt;
&lt;?php foreach ($query->result_array() as $row) {?&gt;
<tr><td>
&lt;?echo "&lt;input type='checkbox' name=\"checked[]\" value=\"$row[todo_id]\"&gt;";?&gt;
</td><td>
&lt;?echo $row['title']?&gt;
</td><td>
&lt;?echo $row['description']?&gt;
</td><td>
&lt;?echo $row['status']?&gt;
</td><td>
&lt;?echo $row['update_date']?&gt;
</td><td>
&lt;?echo "<a href=\"http://localhost/codeigniter/index.php/todo/to_edit\"> edit</a>" ;?&gt;
</td></tr>
&lt;?}?&gt;
&lt;/form&gt;
<table>
<tr><td>&lt;input type="submit" value="Delete Todo"&gt;</td>
<td align="center"><a href = http://localhost/codeigniter/index.php/todo/back>GO back</a></td></tr>
</table>
&lt;/html&gt;


Messages In This Thread
what wrong - by El Forum - 02-14-2008, 10:03 AM
what wrong - by El Forum - 02-14-2008, 10:10 AM
what wrong - by El Forum - 02-14-2008, 12:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB