Page 1 of 1

Need Help with PHP inside an Article

Posted: Mon Mar 03, 2008 4:51 pm
by Plaidfox
I could really use some help. I haven't really worked with PHP for about a year, and I'm still learning joomla. I have joomla 1.5 and I installed the IncludePHP plug-in. What I'm trying to do is pull information from my database onto an article. My code so far is:

{php} defined('_JEXEC') or die('Restricted access');

$db = &JFactory::getDBO();
$num = 1;
$db->setQuery( 'SELECT title FROM #__recipe WHERE id = 1' );
$row = $db->loadResult();
echo $row;
echo "<br />";

$db->setQuery( 'SELECT ingredients FROM #__recipe WHERE id = 1' );
$row = $db->loadResult();
echo $row;
echo "<br />";

$db->setQuery( 'SELECT directions FROM #__recipe WHERE id = 1' );
$row = $db->loadResult();
echo $row;
echo "<br />";

{/php}

I got the information on how to pull individual information from the database through the tutorial:
http://dev.joomla.org/component/option, ... ase_part1/

However, I will not be the one who adds new information to the database. How do I set this up so that it finds out how many entries there are and will echo all of them out onto the article page?