I appreciate the support and the ability to test before buying.
I have the other side of the equation to solve. I've looked everywhere and still seem miles away.
I want to create a variable and use it in my page. The value for the variable was sent by a ChronoForm to a Joomla 1.6 database.
This is what I've managed to put together so far, but I know is wrong and incomplete.
<?php
$db =& JFactory::getDBO();
$owner_id = '10';
$hometown = "
SELECT 'hometown'
FROM '#__owner_profiles' WHERE 'owner' = $owner_id;
";
?>
I want to use this variable in my page <?php echo $hometown; ?>
Any idea what's wrong and missing?
I have the other side of the equation to solve. I've looked everywhere and still seem miles away.
I want to create a variable and use it in my page. The value for the variable was sent by a ChronoForm to a Joomla 1.6 database.
This is what I've managed to put together so far, but I know is wrong and incomplete.
<?php
$db =& JFactory::getDBO();
$owner_id = '10';
$hometown = "
SELECT 'hometown'
FROM '#__owner_profiles' WHERE 'owner' = $owner_id;
";
?>
I want to use this variable in my page <?php echo $hometown; ?>
Any idea what's wrong and missing?
I figured it out. This is to always display the same field from the same row in a database.
1) nameQuote and quote are supposed to be there by Joomla.
2) to use this to display a single field from the current user's record (where user_id is the column name in the table and is "linked" to the user table.) change $owner_id = '10'; to $owner_id = 'user_id';
Now my variable works! <?php echo $hometown; ?>
Everything look okay to everyone else?
1) nameQuote and quote are supposed to be there by Joomla.
2) to use this to display a single field from the current user's record (where user_id is the column name in the table and is "linked" to the user table.) change $owner_id = '10'; to $owner_id = 'user_id';
<?php
$db =& JFactory::getDBO();
$owner_id = '10';
$hometown_query = "
SELECT ".$db->nameQuote('hometown')."
FROM ".$db->nameQuote('#__owner_profiles')."
WHERE ".$db->nameQuote('owner')." = ".$db->quote($owner_id).";
";
$db->setQuery($hometown_query);
$hometown = $db->loadResult();
?>
Now my variable works! <?php echo $hometown; ?>
Everything look okay to everyone else?
This topic is locked and no more replies can be posted.