Hello! I am new to ModX and have only been working with it for about....a week.
I am trying to access some very simple data I have placed into a database to be spit into a page and modified with jquery.
I have looked all over google, all over this site, and tried for the last 3 hours or so to figure this out, but I am just not having any luck. The table is in the modX database (don’t know if this is the right way to do this or not?) so it shouldn’t have any permission issues.
Here is my code:
<?php
$output = '';
$modx->db->connect();
$sql = $modx->db->query( 'SELECT * FROM `businesses` ORDER BY ID');
$resultArray = $modx->db->makeArray( $sql );
foreach($resultArray as $item)
{
$output.=$item;
$params['name']=$item['businessName'];
$params['url']=$item['businessURL'];
$params['category']=$item[businessCategory'];
$params['description']=$item[businessDescription'];
$output.=$modx->parseChunk('businessTpl', $params, '[+', '+]');
}
return $output;
?>
This code is more or less taken from one of the modX wiki pages. I have tried just echoing this data, among other things, and it never really works at all. I tried removing all of the parameters to just spit out what is in the array, but then all it said was array,array,array,array,array,array. I’m confused....I’m also a PHP newb (I come from c#/asp.net) so I’m sure that is going against me as well, but the code above looks sound to me....
I hope someone can shed light on this, and help me and others that may come across this in google.
Thanks!