I have come across a very strange error. I am trying to access database
information from my 'store' database's 'product' table using a TableGateway
(much like the skeleton tutorial application). Everything is setup correctly
as far as I know, including database access credentials within the
global.php and local.php configuration files.
So, within my 'product' DB table, I have 10 different products. My
controller is passing the following view model to the index view:
public function indexAction()
{
return new ViewModel(array(
'products' => $this->getProductTable()->fetchAll(),
));
}
Now, this seems to be working correctly. My index view is as follows:
<?php foreach ($products as $product) : ?>
<?php echo $this->escapeHtml($product->productName);?>
<a href="<?php echo $this->url('catalog',
array('action'=>'addtobasket'));?>">Add To Basket
<?php endforeach; ?>
While no product names are being rendered onto the page, when viewing the
page source, 10 tags are rendering which hints to me that the controller is
working as it should as it is picking up the fact that there are 10
products. However, nothing is within these tags, and the product names
themselves are left behind.
I have checked the privileges within phpmyadmin and everything seems to be
as it should be. I have also used this database in a different
authentication module and everything works fine. I'm just a little confused
as what the problem could be.
Could anyone please try and help a zend noob?
Anyway, thanks in advance, Jamie
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Cannot-Display-Data-from-MySql-Database-onto-View-tp4659644.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]