Feb
13
Way to use Joomla loadAssoc
February 13, 2008 |
mysql_fetch_assoc is the native PHP MySQL function to fetch a result row as an associative array. Joomla! has it’s own database abstraction class that does this job — loadAssoc.
Below is an example of the using loadAssoc to fetch a result row from content table and show the individual selected field results:
$db = JFactory::getDBO(); $query = "SELECT * FROM #__content WHERE title='Overview'"; $db->setQuery($query); $article_row = $db->loadAssoc(); echo $article_row['introtext']."—".$article_row['publish_up'];
The output will the the intro text of the article with the title Overview and followed by published date and time.
Similar Posts
- Proper Way to Use Joomla getNumRows
- Joomla - Use loadObjectList and foreach to get list
- Joomla! - Make Latest News Module Display Date
- Install and Run Joomla on Ubuntu
- Joomla - Link Excerpt Article Title to Full Article
- Joomla Retrieve Admin Password
- Joomla Loads Position Module within Content
- Joomla PDF Display Problem in IE7 Fix
- Joomla Manually Setup Enable SEF URL
- Remove Mootools From Joomla Header
- Joomla add Custom User Groups
- Make Joomla localhost Email Work
Comments
1 Comment so far



































i think many people still prefer the default way PHP handles database, there are just too many custom database libraries.