Haven't Trouble Passing Variables To View |
[eluser]Barwick[/eluser]
Okay, so I'm grabbing the data I need properly from the database. However, how do I take the "echo data" and echo it as a variable in my view? For example Code: <? echo $row1->title; ?> Here's a portion of my controller: Code: // Pricing and package details insert from db I've done a bit of reading and googling...which lead me to doing this...but it's still not working (this is the full modified controller - different from above) http://codepad.org/dkPBQtbL Where am I going wrong?
[eluser]b0ris55[/eluser]
Hard to say but you don't need row(0), row() automatically returns first row. If there is no results it's possible that your $row1 object is empty. After you set that object, in the next line, try outputting it via print_r($row1) to make sure everything you need is in there. Everything seems allright and should work. B
[eluser]Barwick[/eluser]
[quote author="b0ris55" date="1352252098"]Hard to say but you don't need row(0), row() automatically returns first row. If there is no results it's possible that your $row1 object is empty. After you set that object, in the next line, try outputting it via print_r($row1) to make sure everything you need is in there. Everything seems allright and should work. B[/quote] Thanks...echo's fine within controller. Adding it as a variable is the concern. This issue is KILLING me...lol
[eluser]Barwick[/eluser]
[quote author="CroNiX" date="1352255494"]add a limit to your query[/quote] Interesting. So adding a limit to AR would be: Code: $query = $this->db->get('pricing', 1); This correct? If so, produces error: A PHP Error was encountered Severity: Notice Message: Undefined property: stdClass::$Subscription Filename: views/subscribe.php Line Number: 8 Which is this line in my view: Code: <? echo $row1->$title; ?>
[eluser]Aken[/eluser]
$row1->$title is wrong. There is no second $. Should be $row1->title; Also, I'd recommend opening your PHP tags fully, using <?php
[eluser]Barwick[/eluser]
[quote author="Aken" date="1352256802"]$row1->$title is wrong. There is no second $. Should be $row1->title; Also, I'd recommend opening your PHP tags fully, using <?php[/quote] Agh!!! You're right man! I've been stewing over this for a while now. Couldn't figure out wtf I was going wrong. I could hug you man. lol Between CroNIX and you, you two have been a huge help on here. I should be paying you guys... :p |
Welcome Guest, Not a member yet? Register Sign In |