Welcome Guest, Not a member yet? Register   Sign In
Loading a multidimensional array into a view
#1

[eluser]bsteve[/eluser]
Hello to all, i am developing my end of year project but i am stack some where,
I would like to generate reports from a result set created as a result of joining two tables.

this is the query.

$conn = Doctrine_Manager::connection();
$result= $conn->execute('
select p.*,v.*
from Patient p
INNER JOIN Visit v ON p.patient_number = v.patient_number');
$visits = $result->fetchAll();
$this->load->view('patient_visit', $visits);

Every time i try to manipulate the array in the view i get an error message that.

use of undefined variable visits.

below is how i am doing it in the view.

<?php $x =0; ?>

&lt;?php for($x = 0; $x<=count($visits); $x++): ?&gt;
<center>
<table cellspacing="0" cellpadding="5" width="50%" bgcolor="#B9AA81">
<tr><td><b>Patient number:</td>
<td>&lt;?php echo $visits[0]['patient_number']; ?&gt;</td>
<tr>
<td ><b>First name:</td>
<td>&lt;?php echo $visits[0]['first_name']; ?&gt;</td>
<tr>
<td> <b> Last name:</td>
<td>&lt;?php echo $visits[0]['last_name']; ?&gt;</td>
<tr>
<td> <b> Visit code:</td>
<td>&lt;?php echo $visits[0]['visit_code']; ?&gt;</td>
<tr>
<td> <b> Month:</td>
<td>&lt;?php echo $visits['month'];?&gt;</td>

<tr>
<td> <b> Visit date:</td>
<td>&lt;?php echo $visits['visit_date']; ?&gt;</td>
</tr>
</table>
&lt;?php $x++; ?&gt;

&lt;?php endfor; ?&gt;

I would be happy to receive any help.


Messages In This Thread
Loading a multidimensional array into a view - by El Forum - 04-29-2010, 07:18 AM
Loading a multidimensional array into a view - by El Forum - 04-29-2010, 07:58 AM
Loading a multidimensional array into a view - by El Forum - 04-29-2010, 05:04 PM
Loading a multidimensional array into a view - by El Forum - 04-29-2010, 06:00 PM
Loading a multidimensional array into a view - by El Forum - 04-30-2010, 04:05 AM
Loading a multidimensional array into a view - by El Forum - 04-30-2010, 04:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB