Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-02-2008, 09:36 AM
Junior Member
 
Join Date: Apr 2008
Posts: 28
Default put array in $this

Hi!

Another question from me.

I connect to a database and get a row from the database
Code:
$sql = 'SELECT commentaar, id FROM data WHERE id = 1'; // SQL commando
$result = $db->fetchRow($sql);
After this I get the 2 columns and put them in an Array variable

Code:
$lijst = array("a"=>$result->id, "b"=>$result->commentaar);
Next i add this variable ($lijst) to the $this Var

Code:
$this->lijst = $lijst;
got 2 echo statements here to check if there really is something inside the DB

Code:
echo $lijst["a"];
echo $lijst["b"];
Then I get redirected to my view.

Code:
<table border="1px">
	<th><h1 align="center">resultaat</h1></th>
	<tr>
		<td><?= $this->lijst["a"]; ?></td>
		<td><?= $this->lijst["b"]; ?></td>
	</tr>
</table>
I get a page loaded with 1 table on it with a header saying "resultaat" and no table rows or anything?

What am I doing wrong? or can't you pass along arrays? I'm mostly likely passing it along wrongly?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-02-2008, 11:09 AM
Junior Member
 
Join Date: Apr 2008
Posts: 28
Default

Never mind... stupid mistake..

in my indexcontroller it had to be
Code:
$this->view->'var' = value
instead of
Code:
$this->var' = value
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:10 PM.