Welcome Guest, Not a member yet? Register   Sign In
How to display record based on their ID?
#5

(This post was last modified: 07-18-2016, 09:53 AM by pdthinh.)

(07-18-2016, 02:27 AM)theromie Wrote:
(07-18-2016, 01:20 AM)projack89 Wrote: In your view.php

<?php foreach($jobdata as $list):?>
           echo $list->field_name;
<?php endforeach; ?>

I did same but getting error 
Message: Invalid argument supplied for foreach()

In your model change the return statement to:
PHP Code:
if($query->num_rows() > 0)
    return 
$query->result();
else
    return 
NULL

In your view check for the $jobdata is set
Code:
<?php if (isset($jobdata)): ?>
   <?php foreach ($jobdata as $row): ?>
       ...
   <?php endforeach ?>
<?php endif ?>
Reply


Messages In This Thread
RE: How to display record based on their ID? - by pdthinh - 07-18-2016, 09:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB